import { QueueEntry } from './layer'; import { StreamState } from './stream'; /** * Defines the structure for storing the state of an animation. * Contains information about the state of layers and layer clips within the animation. */ export interface AnimationState { /** * Stores the state of each layer by its ID. */ byLayer: { [id: string]: LayerState; }; /** * Stores the state of each layer clip by its ID. */ byLayerClip: { [id: string]: LayerClipState; }; /** * ptional ID of the spotlight layer, if any. */ spotlightLayer?: string; } /** * Represents the state of an individual layer within an animation. */ export interface LayerState { /** * Queue state entries for the layer. */ queue: LayerQueueEntryState[]; /** * Index of the currently active queue entry, if any. */ active?: number | null; } /** * Defines the state of a queue entry within a layer. * Excludes the 'layerClip' object itself, instead referencing it by ID. */ export type LayerQueueEntryState = Omit & { layerClip: string | null | undefined; }; /** * Describes the state of a LayerClip within an animation. */ export interface LayerClipState { /** * Start time of the clip. */ t0: number; /** * End time of the clip, or null to indicate an indefinite duration. */ t1: number | null; /** * The time at which the clip was paused, if applicable. */ pauseTime?: number; /** * Playback rate of the clip. */ rate: number; /** * Indicates whether the clip is set to loop. */ loop: boolean; /** * Indicates whether the clip is stopped. */ stopped: boolean; /** * The current stream state of the clip. */ state: StreamState; }