/** * Type for mapping IDs to objects. */ export type ByID = { [id: string]: T | undefined; }; /** * Type for mapping node properties. */ export type ByNodeProperty = { [id: string]: { [id: string]: T | undefined; } | undefined; }; /** * Interface defining the structure of an Animation. */ export interface Animation { clips: ByID; layers: ByID; curves: ByID; } /** * Type for defining blend methods. */ export type BlendType = 'overlay' | 'add'; /** * Interface for fade parameters. */ export interface FadeParameters { time: number; pin?: number; easing?: Easing; reverse?: boolean; } /** * Interface defining a Layer within an animation. */ export interface Layer { order: string; name: string; scriptName?: string; id: string; defaultFadeParameters?: FadeParameters; clips: ByID; defaultClip?: string | null; enabled: boolean; } /** * Interface defining a LayerClip, a clip within a Layer. */ export interface LayerClip { order: string; id: string; clipId: string; loop?: boolean; reverse?: boolean; playbackSpeed?: number; scriptName?: string; playAtStart?: boolean; } /** * Type for mapping active layer clips. */ export type ActiveLayerClips = ByID; /** * Enum for different types of Clips. */ export declare enum ClipType { Timeline = "timeline", State = "state" } /** * Type for defining clip length types. */ export type ClipLengthType = 'auto' | 'expand' | 'manual'; /** * Interface defining a Clip. */ export interface Clip { order: string; type: ClipType; id: string; name: string; tracks: ByID; length: number; lengthType: ClipLengthType; defaultFadeParameters?: Partial; timeSourceTrack?: string; scriptName?: string; } /** * Interface for a keyframe in an animation. */ export interface Keyframe { id: string; v: any; t: number; label?: string; easing?: Easing; } /** * Predefined curves for easing */ export declare const predefinedCurve: { [id: string]: Bezier[]; }; /** * Type for easing, which can be a predefined curve name or a custom bezier curve. */ export type Easing = null | keyof typeof predefinedCurve | string; /** * Type representing a point in a Bezier curve. */ export type Point = [number, number]; /** * Type representing a Bezier curve. * * @note * Bezier represents the four control points between this keyframe and the next */ export type Bezier = [Point, Point, Point, Point]; /** * Type representing a curve, which is a collection of Bezier segments. */ export type Curve = { id: string; order?: string; name: string; curve: Bezier[]; }; /** * Enum for different types of Tracks in an animation. */ export declare enum TrackType { Property = "property", Clip = "clip", Stream = "stream", Function = "function", Label = "label", Entity = "entity", Blend = "blend", Fade = "fade" } export type Track = PropertyTrack | ClipTrack | StreamTrack | FunctionTrack | LabelTrack; /** * Base interface for a track in an animation. */ export interface BaseTrack { order: string; id: string; type: TrackType; entityID: string; nameHint?: string; lock?: { track?: boolean; weight?: boolean; }; } export interface PropertyTrack extends BaseTrack { type: TrackType.Property; property: (string | number)[]; blend: BlendType; weight: ByID; keyframes: ByID; fadeParameters?: Partial; } export interface ClipTrack extends BaseTrack { type: TrackType.Clip; name: string; data: ByID; weight: ByID; } export interface ClipTrackEntity { id: string; t0: number; t1: number; s0: number; rate: number; } /** * Represents a stream track, extending the base track with specific properties for streaming. */ export interface StreamTrack extends BaseTrack { /** * The type of track, defined as 'Stream'. */ type: TrackType.Stream; /** * The name of the stream track. */ name: string; /** * The data associated with the stream track, mapped by ID. */ data: ByID; /** * The weight of each stream track entity, mapped by ID. */ weight: ByID; /** * An array representing the properties of the stream track. */ property: (string | number)[]; } /** * Describes the structure of a stream track entity. */ export interface StreamTrackEntity { /** * Unique identifier for the stream track entity. */ id: string; /** * Start point on track. */ t0: number; /** * End point on track. */ t1?: number; /** * Start point in stream. */ s0: number; /** * Playback rate of the stream. */ rate: number; } /** * Describes the structure of a function track which is an extension of a base track, */ export interface FunctionTrack extends BaseTrack { /** * Type of track. */ type: TrackType.Function; /** * The data for the function track. */ data: ByID; } /** * Defines a type that represents entities within a function track. */ export type FunctionTrackEntity = EntityFunctionTrackEntity | ImportFunctionTrackEntity; /** * Serves as a base interface for entities within a function track. * Providing common properties independent of the specific function track entity type. */ export interface BaseFunctionTrackEntity { /** * Unique identifier for the function track entity. */ id: string; /** * Start point on track. */ t0: number; /** * The type of function track entity. */ type: 'entity' | 'import'; args: ByID; runAtDesignTime?: boolean; } /** * Represents an entity function track entity, extending the base function track entity. */ export interface EntityFunctionTrackEntity extends BaseFunctionTrackEntity { /** * The type of function track entity, defined as 'entity'. */ type: 'entity'; /** * The ID of the entity associated with the function track. */ entityID: string; /** * The name of the function to be executed. */ functionName: string; } /** * Represents an import function track entity, extending the base function track entity. */ export interface ImportFunctionTrackEntity extends BaseFunctionTrackEntity { /** * The type of function track entity, defined as 'import'. */ type: 'import'; /** * The import path or identifier. */ import: string; } /** * Represents a label track, extending the base track with specific data for labels. */ export interface LabelTrack extends BaseTrack { /** * The type of track, defined as 'Label'. */ type: TrackType.Label; /** * The data for the label track, mapped by ID. */ data: ByID; } /** * Describes the structure of a label track entity. */ export interface LabelTrackEntity { /** * The order of the label in the track. */ order: string; /** * The time point of the label on the track. */ t: number; /** * The text label. */ label: string; }