import { Observable } from '../observable'; import { Animation } from './animation'; import { AnimationState } from './animationstate'; import { Easing } from './bezier'; import { LayerClip, LayerClipPlayOptions } from './layerclip'; /** * Defines the parameters for a fade effect. * * @interface * @property time - The duration of the fade effect in seconds. * @property pin - Optional. This value (between 0 and 1) indicates if this fade takes place at the beginning (0), middle (0.5) or end (1) of the transition. * @property easing - Optional. The easing function to be used for the fade effect. * @property reverse - Optional. A boolean indicating if the fade effect should be reversed. */ export interface FadeParameters { time: number; pin?: number; easing?: Easing; reverse?: boolean; } /** * Represents a layer within an animation. Manages a collection of LayerClips and their playback within the layer. * Supports queuing of clips, computation of path properties, and handling fade parameters. */ export declare class Layer { readonly animation: Animation; readonly scriptName?: string | undefined; readonly id?: string | undefined; /** * Collection of LayerClips indexed by ID. */ clips: { [id: string]: LayerClip; }; /** * Optional default fade parameters for the layer. */ defaultFadeParameters?: FadeParameters; /** * Observable indicating if the influenced paths are dirty. */ influencedPathsDirty: Observable; private _influencedPaths; private _active; private _queue; private _layerClips; /** * Creates an instance of Layer. * @param animation - The animation that the layer belongs to. * @param scriptName - Optional. The name of the script that the layer belongs to. * @param id - Optional. The ID of the layer. */ constructor(animation: Animation, scriptName?: string | undefined, id?: string | undefined); /** * Computes the property value for a given path at a specified time. * Applies fade parameters and clip-specific computations. * * @param t The current time. * @param p The path of the property to compute. * @param valueBefore The initial value of the property before computation. * @returns The computed property value. */ computePathProperty(t: number, p: string, valueBefore: any): any; /** @internal */ tick(t: number, touchedPaths: string[]): void; /** * Pauses the currently active LayerClip, if any. */ pause(): void; /** @internal */ _registerLayerClip(layerClip: LayerClip): void; /** * Queues a LayerClip for playback with optional play options. * * @param layerClip The LayerClip to queue. * @param playOptions Optional play options for the clip. * @returns The created QueueEntry. */ queue(layerClip: LayerClip | null, playOptions?: LayerClipPlayOptions): QueueEntry; /** * Gets the currently active LayerClip. * * @returns The active LayerClip, if any. */ get active(): LayerClip | null | undefined; /** * Sets the active LayerClip for the layer. * * @param layerClip The LayerClip to set as active. */ set active(layerClip: LayerClip | null | undefined); /** * Sets the active LayerClip with optional play options. * * @param layerClip The LayerClip to set as active. * @param playOptions Optional play options for the clip. */ setActive(layerClip: LayerClip | null, playOptions?: LayerClipPlayOptions): void; /** @internal */ _activateLayerClip(layerClip: LayerClip | null | undefined, playOptions?: LayerClipPlayOptions): void; /** @internal */ _evaulate(): void; private _getTime; /** @internal */ _serialize(state: AnimationState): void; /** @internal */ _restore(state: AnimationState): void; /** * Gets the set of paths influenced by the layer. * * @returns A set of strings representing the influenced paths. */ get influencedPaths(): Set; } /** * Represents an entry in the queue of a Layer, containing a LayerClip and related playback options. * @internal */ export interface QueueEntry { layerClip: LayerClip | null; playOptions?: LayerClipPlayOptions; fadeByPath: { [id: string]: Partial; }; fadeTime: number; startTime?: number; }