作る

tween

Performs a requestAnimationFrame-driven tween between two numbers. Returns a cancellation handle for aborting the animation.

tween

Performs a requestAnimationFrame-driven tween between two numbers. Returns a cancellation handle for aborting the animation.

Examples

tween({
  from: 0,
  to: 1,
  duration: 500,
  onUpdate: (alpha) => overlay.setOpacity(alpha),
});

Signature

tween(options: TweenOptions): { cancel: () => void; }