Last active
January 1, 2016 21:18
-
-
Save jsl/8202285 to your computer and use it in GitHub Desktop.
Happy (functional) 2014!
This file contains hidden or 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
-- 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