RAF
Bindings for @solid-primitives/raf.
FrameRequestCallback
type FrameRequestCallback = float -> unit
createRAF
let createRAF(
callback: FrameRequestCallback
): running: Accessor<bool> * start: VoidFunction * stop: VoidFunction
| Param | Desc |
|---|---|
callback | The callback to run on each frame. |
| Returns | Desc |
|---|---|
running | Signal of whether it is running. |
start | Starts the loop. |
stop | Stops the loop. |
A reactive window.requestAnimationFrame loop that is disposed automatically when its owner is cleaned up.
targetFPS
let targetFPS(
callback: FrameRequestCallback,
fps: float | Accessor<float>
): FrameRequestCallback
Caps a frame callback at fps frames per second by skipping frames, so frame durations can be uneven.
createMs
let createMs(
fps: float | Accessor<float>,
?limit: float | Accessor<float>
): MsCounter
A signal that counts up milliseconds at a given frame rate, to base animations on.
MsCounter
type MsCounter = interface
| Member | Desc |
|---|---|
current: int | The current value. Compiles to msCounter(). |
reset(): unit | Resets the counter. |
running(): bool | Whether the counter is running. |
start(): unit | Restarts the counter if it is stopped. |
stop(): unit | Stops the counter if it is running. |
