Skip to content

Instantly share code, notes, and snippets.

@sroccaserra
Last active August 29, 2015 14:16
Show Gist options
  • Select an option

  • Save sroccaserra/770c4e98f5e44d3b17d6 to your computer and use it in GitHub Desktop.

Select an option

Save sroccaserra/770c4e98f5e44d3b17d6 to your computer and use it in GitHub Desktop.
Simple time updated point, try it here: http://elm-lang.org/try
import Graphics.Element exposing (Element, show)
import Signal exposing (Signal, map, foldp)
import Time exposing (fps)
type alias Point = {x: Float, y: Float}
main : Signal Element
main =
map show <| foldp update {x=0, y=0} (fps 30)
update : Float -> Point -> Point
update dt g =
{g | x <- g.x + dt}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment