Skip to content

Instantly share code, notes, and snippets.

@robertjlooby
Created January 25, 2015 22:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertjlooby/ed57f64271eb46641861 to your computer and use it in GitHub Desktop.
Save robertjlooby/ed57f64271eb46641861 to your computer and use it in GitHub Desktop.
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