rotating rainbow circles
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