As of Elm 0.17, this package has been replaced with elm-lang/animation-frame, which provides an animation frame subscription in place of this package's animation frame signal.
AnimationFrame.frameWhen instead of
(Time.fps 60) or
(Time.fpsWhen 60) makes it possible (but not guaranteed...) to achieve 60 fps animation without stutter in Elm.
import AnimationFrame import Graphics.Element import Signal main = Signal.map Graphics.Element.show (Signal.foldp (+) 0 AnimationFrame.frame)
examples/counter.elm for a minimal working example that uses both
AnimationFrame.frameWhen. You can see this example in action here. The top counter uses
AnimationFrame.frame to count continuously. The bottom counter uses
AnimationFrame.frameWhen to count only when the mouse is down.
The following simple animation demonstrates the performance difference between using core's