haste-compiler- Haskell To ECMAScript compiler

Safe HaskellNone



Request and cancel animation frames from the browser. Straightforward bindings to the corresponding DOM interface.



data FrameRequest

Handle to a previously issued request for an animation frame. Only useful together with cancelAnimationFrame.

requestAnimationFrame :: (HRTimeStamp -> IO ()) -> IO FrameRequest

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 ()

Cancel an animation callback previously requested by requestAnimationFrame.