Skip to main content

Function: prepareAnimation()

prepareAnimation(animInput): Animation

Defined in: animation/AnimationUtilities.ts:92

prepareAnimation - Normalize animation input to a consistent Animation instance

Accepts an Animation object, a callable that returns an Animation, or other animation-like inputs and converts them to a proper Animation instance.

Parameters

animInput

An Animation instance, a function returning an Animation, or a Mobject

Animation | () => Animation

Returns

Animation

A normalized Animation instance

Example

// Direct animation
const anim1 = prepareAnimation(new FadeIn(circle));

// Function that returns animation
const anim2 = prepareAnimation(() => new FadeIn(circle));

// With animation args
const anim3 = prepareAnimation(new Create(square, { duration: 2 }));