/** * Normalized options for a played animation, shared by the 2D {@link Sprite} * frame-animation path and the 3D {@link Mesh} keyframe-animation path so both * accept the same `setCurrentAnimation(name, …)` second argument. * @category Animation */ export interface AnimationOptions { /** called when the animation completes a cycle (each loop, or once if `loop: false`). */ onComplete?: (() => unknown) | undefined; /** name of an animation to switch to when this one finishes. */ next?: string | undefined; /** loop forever (default) or play once and hold the last frame. */ loop: boolean; /** playback rate multiplier (1 = authored speed). */ speed: number; } /** * What a caller may PASS as the second argument of `setCurrentAnimation`. * * The loose counterpart of {@link AnimationOptions}, which is what those * choices normalize TO. Every field here is optional, because the defaults are * the point: `{ loop: true }` has to be a complete thing to say. Typing an * argument as the normalized shape instead makes `loop` and `speed` mandatory * and turns the shortest useful call into a type error. * @category Animation */ export type AnimationOptionsInput = string | (() => unknown) | { /** called when the animation completes a cycle */ onComplete?: () => unknown; /** name of an animation to switch to when this one finishes */ next?: string; /** loop forever (default) or play once and hold the last frame */ loop?: boolean; /** playback rate multiplier (1 = authored speed) */ speed?: number; }; /** * Normalize the polymorphic second argument of `setCurrentAnimation` into a * uniform {@link AnimationOptions}. Accepts: * - `undefined` → loop forever * - a `string` → the name of the next animation to chain to * - a `function` → legacy completion callback (return `false` to hold the last frame) * - an options object → `{ onComplete, next, loop, speed }` * @param arg - the second argument passed to `setCurrentAnimation` * @returns the normalized options * @category Animation */ export declare function parseAnimationOptions(arg?: AnimationOptionsInput | null): AnimationOptions; //# sourceMappingURL=animation.d.ts.map