Safe Haskell | None |
---|---|
Language | Haskell98 |
Request and cancel animation frames from the browser. Straightforward bindings to the corresponding DOM interface.
- data FrameRequest
- type HRTimeStamp = Double
- requestAnimationFrame :: (HRTimeStamp -> IO ()) -> IO FrameRequest
- cancelAnimationFrame :: FrameRequest -> IO ()
Documentation
data FrameRequest Source
Handle to a previously issued request for an animation frame.
Only useful together with cancelAnimationFrame
.
type HRTimeStamp = Double Source
requestAnimationFrame :: (HRTimeStamp -> IO ()) -> IO FrameRequest Source
Request a function to be called by the browser before the next repaint. Paints generally happen in tune with the user's monitor refresh rate, which usually means at 60 FPS.
Do note that you need to request *each* animation callback you plan to
use, similar to setTimeout
as opposed to setInterval
, as they are not
recurring.
cancelAnimationFrame :: FrameRequest -> IO () Source
Cancel an animation callback previously requested by
requestAnimationFrame
.