This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
DEPRECATED: replaced by elm-lang/animation-frame
version 1.0.6
license BSD3
native-modules True
elm-version 0.16.0 <= v < 0.17.0
Tag 1.0.6
Committed At 2016-05-30 19:51:40 UTC
elm-lang/core 3.0.0 <= v < 4.0.0 3.0.0



Deprecation Notice

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.

Legacy Documentation:

This library provides time Signals that are synchronized to the monitor's frame rate, by binding javascript's requestAnimationFrame. Using AnimationFrame.frame or 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.

Example Usage

import AnimationFrame
import Graphics.Element
import Signal

main = (Signal.foldp (+) 0 AnimationFrame.frame)

See examples/counter.elm for a minimal working example that uses both AnimationFrame.frame and 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.

Performance Comparison

The following simple animation demonstrates the performance difference between using core's Time.fps, and AnimationFrame.frame