Documentation / @andrew_l/dom / animateSingle
Function: animateSingle() ​
animateSingle(
tick
,instance?
):void
Animates a single tick of an animation, running repeatedly until cancelled or the tick function returns false
.
If an instance
is provided, it will control the cancellation state of the animation. Otherwise, a new animation instance is created and assigned as the current instance. This function uses fastRaf
to run the animation in the next available frame.
Parameters ​
tick ​
Function
A function to be called on each frame, returning true
to continue animating or false
to stop.
instance? ​
AnimationInstance
An optional animation instance to control cancellation state.
Returns ​
void
Example ​
ts
animateSingle(() => {
// Your tick logic here (e.g., move an element)
return true; // Return `true` to keep animating, `false` to stop.
});