RAF
FrameRequestCallback
type FrameRequestCallback = float -> unitcreateRAF
let createRAF( callback: FrameRequestCallback ): running: Accessor<bool> * start: VoidFunction * stop: VoidFunction| Param | Desc |
|---|---|
callback | The callback to run each frame |
| Returns | Desc |
|---|---|
running | Signal for if currently running |
start | Starts the sequence |
stop | Stops the sequence |
A primitive for creating reactive window.requestAnimationFrame that is automatically disposed onCleanup.
targetFPS
let targetFPS( callback: FrameRequestCallback, fps: float | Accessor<float> ): FrameRequestCallbackA primitive for wrapping a window.requestAnimationFrame callback function to limit the execution of the callback
to the specified number of frames per second.
Keep in mind that limiting FPS is achieved by not executing a callback if the frames are above the defined limit. This can lead to inconsistent frame durations.
createMs
let createMs( fps: float | Accessor<float>, ?limit: float | Accessor<float> ): MsCounterA primitive that creates a signal counting up milliseconds with a given frame rate to base your animations on.
Contrary to the original implementation, the binding accesses the current value of the returned counter using
counter.current instead of counter().
MsCounter
type MsCounter = interfacemember current: intThis calls the MsCounter in the runtime: msCounter().
member reset(): unitManually reset the counter.
member running(): boolReturns if the counter is currently running.
member start(): unitRestarts the counter if stopped.
member stop(): unitStops the counter if running.
Last updated: 7/11/25, 1:35 AM