Skip to main content
Partas

RAF

FrameRequestCallback

type FrameRequestCallback = float -> unit

createRAF

let createRAF(
callback: FrameRequestCallback
): running: Accessor<bool> * start: VoidFunction * stop: VoidFunction
ParamDesc
callbackThe callback to run each frame
ReturnsDesc
runningSignal for if currently running
startStarts the sequence
stopStops the sequence

A primitive for creating reactive window.requestAnimationFrame that is automatically disposed onCleanup.

targetFPS

let targetFPS(
callback: FrameRequestCallback,
fps: float | Accessor<float>
): FrameRequestCallback

A 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>
): MsCounter

A primitive that creates a signal counting up milliseconds with a given frame rate to base your animations on.

important

Contrary to the original implementation, the binding accesses the current value of the returned counter using counter.current instead of counter().

MsCounter

type MsCounter = interface
member current: int

This calls the MsCounter in the runtime: msCounter().

member reset(): unit

Manually reset the counter.

member running(): bool

Returns if the counter is currently running.

member start(): unit

Restarts the counter if stopped.

member stop(): unit

Stops the counter if running.

Last updated: 7/11/25, 1:35 AM

PartasBuilt using the Partas.SolidStart SolidBase template
Community
githubdiscord