Skip to content

Instantly share code, notes, and snippets.

@nebuta nebuta/circles.elm
Created Sep 3, 2014

Embed
What would you like to do?
Circles zooming
import Mouse
main = lift scene v
scene : Float -> Element
scene v = collage 600 600 (objs v ++ [
toForm <| plainText (show v)])
objs : Float -> [Form]
objs factor = map (render factor) <| filter (pred factor) [30,20,10,5]
render : Float -> Float -> Form
render f x = filled (hsla (x/50*pi) 0.5 0.5 (min 1 (f*x/100))) <| circle (f*x)
pred n f = n * f >= 30
v : Signal Float
v = lift (f . toFloat . fst) Mouse.position
f x = range 0 10 . (\x -> x / 20) <| (x - 50)
min x y = if x < y then x else y
max x y = if x > y then x else y
range x y v = max x (min v y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.