Skip to content

Instantly share code, notes, and snippets.

@jsl
Last active January 1, 2016 21:18
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 jsl/8202285 to your computer and use it in GitHub Desktop.
Save jsl/8202285 to your computer and use it in GitHub Desktop.
Happy (functional) 2014!
-- Hope you have a functional 2014!
-- Author: Justin Leitgeb
-- Web: http://justinleitgeb.com
-- Twitter: @justinleitgeb
-- Consulting: http://stackbuilders.com
-- Try Elm: http://elm-lang.org
render time =
let ball = filled blue (circle 30)
ground = filled darkGreen (rect 300 50)
ballPosition = 25 - time / 50
confettiUrl = "https://s3.amazonaws.com/newyears2014/confetti.gif"
changeItem = if ballPosition > -45 then
[ ball |> move (0, ballPosition) ]
else
[ toForm <| image 300 200 confettiUrl
, toForm <| Text.text <| Text.bold <| Text.height 35
<| toText "Happy New Year!!!"
]
in
collage 300 200 <| [ ground |> move (0, -100) ] ++ changeItem
main = lift render (foldp (+) 0 (fps 30))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment