Skip to content

Documentation / @andrew_l/dom / animate

Function: animate() ​

animate(tick): void

Continuously animates by repeatedly calling the tick function until it returns false.

The function uses fastRaf to run the animation and continues until the tick function no longer returns true.

Parameters ​

tick ​

Function

The tick function to be executed on each frame. If it returns false, the animation stops.

Returns ​

void

Example ​

ts
animate(() => {
  // Your animation logic here
  return true; // Return `true` to continue animating, `false` to stop.
});