Safe Haskell | None |
---|---|
Language | Haskell98 |
Animation frames are the browser's mechanism for smooth animation. An animation frame callback is run just before the browser repaints.
When the content window is inactive, for example when the user is looking at another tab, it can take a long time for an animation frame callback to happen. Be careful structuring evaluation around this! Typically this means carefully forcing the data before the animation frame is requested, so the callback can run quickly and predictably.
Synopsis
- waitForAnimationFrame :: IO Double
- inAnimationFrame :: OnBlocked -> (Double -> IO ()) -> IO AnimationFrameHandle
- cancelAnimationFrame :: AnimationFrameHandle -> IO ()
- data AnimationFrameHandle
Documentation
waitForAnimationFrame :: IO Double Source #
Wait for an animation frame callback to continue running the current
thread. Use synchronously
if the thread should
not be preempted. This will return the high-performance clock time
stamp once an animation frame is reached.
:: OnBlocked | what to do when encountering a blocking call |
-> (Double -> IO ()) | the action to run |
-> IO AnimationFrameHandle |
Run the action in an animationframe callback. The action runs in a synchronous thread, and is passed the high-performance clock time stamp for that frame.
cancelAnimationFrame :: AnimationFrameHandle -> IO () Source #
data AnimationFrameHandle Source #