import { Layer } from './layer'; import { Observable } from '../observable'; import { Event } from '../event'; import { LayerClip } from './layerclip'; import { Clip } from './clips/clip'; import { AnimationState } from './animationstate'; import { Track } from './tracks/track'; import { Bezier } from './bezier'; /** @internal */ export declare enum AnimationEvents { onLayerClipNotActive = "onLayerClipNotActive", onLayerClipActive = "onLayerClipActive", onLayerClipState = "onLayerClipState" } /** * Manages animations through layers, clips, and tracks. * Provides functionality for serialization and restoration of animation states. * Handles adding and removing layers, and controls animation updates via a tick method. * Ensures proper initialization, disposal, and entity property influence, and emits events based on animation progression. */ export declare class Animation { private _initialize; /** * @internal */ _FIX_SERIALIZE: boolean; /** * Collection of layers indexed by ID. */ layers: { [id: string]: Layer; }; /** * Collection of clips indexed by ID. */ clips: { [id: string]: Clip; }; curves: { [id: string]: Bezier; }; onTick: Event<[]>; onLayerClipNotActive: Event<[layerClip: LayerClip]>; onLayerClipActive: Event<[layerClip: LayerClip]>; onLayerClipState: Event<[layerClip: LayerClip]>; /** * Map for quick access to animation elements by ID. */ clipByID: Map; /** * Map for quick access to animation elements by ID. */ layerByID: Map; /** * Map for quick access to animation elements by ID. */ layerClipByID: Map; /** * Map for quick access to animation elements by ID. */ trackByID: Map; /** * Observable indicating whether there are any layers. */ hasLayers: Observable; private _layers; private _spotlightLayer?; /** * Source of time for the animation. */ timeSource: (() => number) | undefined; private _entityPaths; private _defaultValuesByPath; /** @internal */ _pendingEvents: { evt: AnimationEvents; args: any[]; }[]; /** * Creates an instance of Animation. * @param _initialize Whether to initialize the animation. Defaults to true. */ constructor(_initialize?: boolean); /** * Serializes the current state of the animation. * * @returns The serialized state of the animation. */ serializeState(): AnimationState; /** * Restores the animation state from a serialized state. * * @param state The serialized state to restore. */ restoreState(state: AnimationState): void; /** * Disposes of the animation, clearing listeners and internal state. */ dispose(): void; /** * Adds a new layer to the animation. * * @param l The layer to add. */ addLayer(l: Layer): void; /** * Inserts a layer at a specified index. * * @param l The layer to insert. * @param indx The index at which to insert the layer. */ insertLayer(l: Layer, indx: number): void; /** * Removes a layer from the animation. * * @param l The layer to remove. */ removeLayer(l: Layer): void; /** * Initializes the animation, evaluating paths and preparing state. */ initialize(): void; /** * Updates the animation state based on the current time. */ tick(): void; /** @internal */ registerEntityProperty(path: string, entity: any, property: string | number): void; /** * Evaluates touched paths and updates entity values based on the current time. * * @param paths The paths to evaluate. * @param t Optional current time. */ evaluateTouchedPaths(paths: string[], t?: number): void; /** * Gets the current spotlight layer. * * @returns The current spotlight layer, if any. */ get spotlightLayer(): Layer | undefined; /** * Sets the spotlight layer, influencing the rendering of layers. * * @param l The layer to set as the spotlight layer. */ set spotlightLayer(l: Layer | undefined); /** * Clears cached default values for a specified entity and property. * * @param entityID The ID of the entity. * @param prop The property to clear. */ clearCachedDefault(entityID: string, prop: string): void; private _emitPendingEvents; /** * * Starts the animation, playing clips that are set to play at the start. */ start(): void; }