Skip to content

RAF

Bindings for @solid-primitives/raf.

type FrameRequestCallback = float -> unit

let createRAF(callback: FrameRequestCallback): running: Accessor<bool> * start: VoidFunction * stop: VoidFunction
let targetFPS(callback: FrameRequestCallback, fps: float | Accessor<float>): FrameRequestCallback
let createMs(fps: float | Accessor<float>, ?limit: float | Accessor<float>): MsCounter
  • createRAF is a requestAnimationFrame loop that is disposed with its owner. It returns a signal of whether it is running, and functions that start and stop it.
  • targetFPS caps a frame callback at fps frames per second by skipping frames, so frame durations can be uneven.
  • createMs counts up milliseconds at a given frame rate, to base animations on.
MsCounter memberDesc
current: intThe current value. Compiles to msCounter(); upstream reads it with counter().
reset(): unitResets the counter.
running(): boolWhether the counter is running.
start(): unitRestarts the counter if it is stopped.
stop(): unitStops the counter if it is running.
Edit this page