import { type AnimatableProperty, type AnimationHistoryTarget, type AnimationLoopMode, type CanvasAnimationState, type Clock } from '@pixerate/editor/canvas'; import type { CanvasNode } from './types.js'; export interface CreateCanvasAnimationOptions { getNodes: () => TNode[]; setNodes: (nodes: TNode[]) => void; /** When set, keyframe edits are undoable steps. */ history?: AnimationHistoryTarget; /** Ids acted on without explicit ids (default: nodes with `selected: true`). */ getSelectedIds?: () => string[]; /** Playback time source (default `realClock`); pass a `ManualClock` for tests or rendering. */ clock?: Clock; /** Fixed timeline length (ms); omitted = the last keyframe, at least `minDuration`. */ duration?: number; minDuration?: number; loop?: AnimationLoopMode; playbackRate?: number; fps?: number; recording?: boolean; properties?: readonly AnimatableProperty[]; onTime?: (time: number) => void; } /** * Headless Svelte 5 rune for keyframe animation on the canvas (the Svelte twin of * `useCanvasAnimation`): playback on an injectable clock, record mode, undoable keyframe * edits, multi-keyframe drags with snapping, copy / paste and CSS / Web Animations export. * * Render `displayNodes` (the nodes evaluated at the playhead) and route edits made on them * through `applyDisplayChanges`, so animated properties are keyed at the playhead. Call * `refresh()` after changing the nodes yourself so the automatic duration follows them. */ export declare function createCanvasAnimation(options: CreateCanvasAnimationOptions): { state: CanvasAnimationState; time: number; playing: boolean; recording: boolean; duration: number; selection: readonly import("@pixerate/editor/canvas").KeyframeRef[]; drag: import("@pixerate/editor/canvas").KeyframeDragState | null; revision: number; clipboard: import("@pixerate/editor/canvas").AnimationKeyframeClipboard | null; displayNodes: TNode[]; destroy(): void; player: import("@pixerate/editor/canvas").AnimationPlayer; getState: () => CanvasAnimationState; subscribe(listener: (state: CanvasAnimationState) => void): () => void; refresh(): void; play: () => void; pause: () => void; toggle: () => void; stop: () => void; seek: (time: number) => void; scrub: (time: number) => void; endScrub: () => void; setLoop: (loop: AnimationLoopMode) => void; setPlaybackRate: (rate: number) => void; setDuration(ms: number | null): void; setFps(value: number): void; setRecording(on: boolean): void; toggleRecording(): void; nextKeyframe(ids?: Iterable): number | null; previousKeyframe(ids?: Iterable): number | null; display: (nodes?: readonly any[] | undefined) => any[]; applyDisplayChanges(next: any[]): import("@pixerate/editor/canvas").KeyframeRef[]; addKeyframe(ids?: Iterable, keys?: readonly string[], time?: number): import("@pixerate/editor/canvas").KeyframeRef[]; setKeyframe(nodeId: string, property: string, value: import("@pixerate/editor/canvas").AnimationValue, time?: number, easing?: import("@pixerate/editor/canvas").AnimationEasing | string): void; updateKeyframe(ref: import("@pixerate/editor/canvas").KeyframeRef, patch: import("@pixerate/editor/canvas").KeyframePatch): void; deleteKeyframes(refs?: readonly import("@pixerate/editor/canvas").KeyframeRef[]): boolean; setEasing(easing: import("@pixerate/editor/canvas").AnimationEasing | string | null, refs?: readonly import("@pixerate/editor/canvas").KeyframeRef[]): boolean; setTrackEnabled(nodeId: string, property: string, enabled: boolean): void; removeTrack(nodeId: string, property: string): void; setMotionPath(nodeId: string, motionPath: { d: string; autoRotate?: boolean; } | null): void; animateNode(nodeId: string, opts: Omit): import("@pixerate/editor/canvas").KeyframeRef[]; moveKeyframes(delta: number, refs?: readonly import("@pixerate/editor/canvas").KeyframeRef[]): number; scaleKeyframes(factor: number, refs?: readonly import("@pixerate/editor/canvas").KeyframeRef[], pivot?: number): number; copyKeyframes(refs?: readonly import("@pixerate/editor/canvas").KeyframeRef[]): import("@pixerate/editor/canvas").AnimationKeyframeClipboard | null; pasteKeyframes(data?: import("@pixerate/editor/canvas").AnimationKeyframeClipboard | null, nodeIds?: readonly string[], time?: number): import("@pixerate/editor/canvas").KeyframeRef[]; selectKeyframes(refs: readonly import("@pixerate/editor/canvas").KeyframeRef[], mode?: "replace" | "add" | "toggle"): void; clearSelection(): void; beginKeyframeDrag(refs?: readonly import("@pixerate/editor/canvas").KeyframeRef[]): void; updateKeyframeDrag(delta: number, opts?: { snap?: boolean; thresholdMs?: number; }): import("@pixerate/editor/canvas").KeyframeDragState | null; endKeyframeDrag(): number; cancelKeyframeDrag(): void; timelineRows(ids?: Iterable, opts?: Omit): import("@pixerate/editor/canvas").TimelineRow[]; sampleFrames(opts?: import("@pixerate/editor/canvas").SampleAnimationOptions): import("@pixerate/editor/canvas").AnimationFrame[]; exportCss(nodeId: string, opts?: import("@pixerate/editor/canvas").CssExportOptions & { name?: string; selector?: string; }): import("@pixerate/editor/canvas").CssAnimationExport; toWebAnimations(nodeId: string, opts?: import("@pixerate/editor/canvas").CssExportOptions): import("@pixerate/editor/canvas").WebAnimationSpec[]; }; export type SvelteCanvasAnimation = ReturnType>;