Skip to article

frame

frame() schedules tasks on Motion's animation loop, batching reads, updates, and renders.

frame is used to schedule a function to run on Motion's animation loop. Using Motion's animation loop:

  • Prevents layout thrashing.

  • Provides an easy keep-alive API for creating your own animation loop.

  • Avoids the significant performance overhead of multiple requestAnimationFrame calls.

Usage

Import frame from Motion:

import { frame }