Created
January 25, 2015 22:13
-
-
Save robertjlooby/ed57f64271eb46641861 to your computer and use it in GitHub Desktop.
rotating rainbow circles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Color (..) | |
import Graphics.Collage (..) | |
import Graphics.Element (..) | |
import List | |
import Signal | |
import Time | |
main : Signal Element | |
main = Signal.map display angle | |
display : Float -> Element | |
display angle = collage 150 150 [rotateClockwise circles angle] | |
angle : Signal Float | |
angle = Signal.foldp (\_ angle -> angle + 1) 0 (Time.every (10 * Time.millisecond)) | |
rotateClockwise : Form -> Float -> Form | |
rotateClockwise form angle = rotate ((negate << degrees) angle) form | |
circles : Form | |
circles = List.map shape [0..11] | |
|> group | |
shape : Int -> Form | |
shape n = | |
let angle = degrees (30 * toFloat n) | |
in | |
circle 10 | |
|> filled (hsl angle 0.7 0.5) | |
|> move (45 * cos angle, 45 * sin angle) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment