import { FadeParameters } from '../data'; import { Event } from '../event'; import { Observable } from '../observable'; import { Animation } from './animation'; import { AnimationState } from './animationstate'; import { Clip } from './clips/clip'; import { Layer } from './layer'; import { PlayOptions, Stream, StreamState } from './stream'; /** * Represents a clip within a layer of an animation. * Manages playback, state transitions, and property computations for the clip. * */ export declare class LayerClip implements Stream { readonly layer: Layer; readonly clip: Clip; readonly scriptName?: string | undefined; readonly id?: string | undefined; /** * Default behavior for whether the clip loops when it reaches the end. */ defaultLoop: boolean; /** * Default speed at which the clip plays. */ defaultPlaySpeed: number; /** * Indicates if the clip should automatically start playing at the beginning of the animation. */ playAtStart: boolean; /** * Function providing the current time, used for synchronizing the clip's playback. */ timeSource: (() => number) | undefined; /** * Reference to the animation that this layer clip is a part of. */ readonly animation: Animation; private _t0; private _pauseTime; private _stallStartTime; private _t1; private _rate; private _loop; private _lastTickTime; private _lastClipTime; private _lastLoop; private _stopped; private _state; state: Observable; playing: Observable; stalled: Observable; active: Observable; onPlaying: Event<[LayerClip]>; onPaused: Event<[LayerClip]>; onEnded: Event<[LayerClip]>; onLoop: Event<[LayerClip]>; /** * Creates an instance of LayerClip. * @param layer - The layer that this clip belongs to. * @param clip - The clip that this layer clip is based on. * @param scriptName - The name of the script that created this layer clip. * @param id - The ID of the layer clip. */ constructor(layer: Layer, clip: Clip, scriptName?: string | undefined, id?: string | undefined); private _clipDirty; /** @internal */ tick(touchedPaths: string[], force?: boolean): void; /** * Computes the property value for a specific path based on the current state of the clip. * * @param p The path of the property to compute. * @param valueBefore The initial value before applying clip-specific computations. * @returns The computed property value. */ computePathProperty(p: string, valueBefore: any): any; /** * Estimates the remaining time for the clip to finish playing. * * @returns The estimated remaining time in milliseconds. */ getRemainingTimeEstimate(): number; private _getTime; private _stateUpdate; /** * Queues the LayerClip for playback with optional play options. * * @param opts Optional play options to customize playback behavior. */ queue(opts?: LayerClipPlayOptions): this; /** * @returns The length of the clip. */ length(): number; /** * Plays the clip, optionally with specified play options. * * @param opts Optional play options to customize playback behavior. */ play(opts?: LayerClipPlayOptions): this; /** * Pauses the playback of the clip. */ pause(): this; private _cancelStall; /** * Seeks to a specific time within the clip and optionally applies fade parameters. * * @param ct The clip time to seek to. * @param opts Optional seek options, including fade parameters. */ seek(ct: number, opts?: LayerClipSeekOptions): this; /** @internal */ _serialize(state: AnimationState): void; /** @internal */ _restore(state: AnimationState): void; /** * Gets the current clip time. * * @returns The current time within the clip. */ get clipTime(): number; /** * Stops the clip's playback. */ stop(): this; /** * Determines if the clip is currently stalled. * * @returns True if the clip is stalled, false otherwise. */ isStalled(): boolean; } export interface LayerClipSeekOptions { fade?: FadeParameters | null; dontActivateLayer?: boolean; } export interface LayerClipPlayOptions extends PlayOptions { fade?: Partial | null; }