import type { ThenFn } from '../value/thenable'; import type { DecayOptions } from '../physics/decay'; import type { SpringOptions } from '../physics/spring'; import type { ToOptions } from '../physics/tween'; import type { Scheduler } from '../scheduler/scheduler'; import type { Animatable, AnimationHandle } from '../value/animatable'; import type { PlaybackOptions } from './handle'; export interface SequenceOptions extends Pick { /** Frame loop. Tests inject createScheduler(createManualDriver()). Default the shared rAF loop. */ scheduler?: Scheduler; /** Spring/tween knobs merged into every leg (a leg's own options win). */ defaults?: SpringOptions & ToOptions; } /** Where a leg starts relative to the previous one - the only positioning a live sequence has. */ export interface LegOptions { /** * Start this leg `overlap` ms after the PREVIOUS leg STARTED - the cascade * feel, springs handing off mid-flight. Omitted: start when the previous leg * comes to rest (strict order). */ overlap?: number; } export type SpringLegOptions = LegOptions & SpringOptions; export type ToLegOptions = LegOptions & ToOptions; export type DecayLegOptions = LegOptions & DecayOptions; export interface StaggerLegOptions extends LegOptions { /** Per-item spacing in ms. */ each: number; } /** * The live twin of a timeline. Legs run in authored order on completion events * (no master clock): each starts when the previous rests, or `overlap` ms after * it starts. Every leg is a live spring/decay/tween, so a value stays * interruptible - retarget it mid-flight and the motion hands off with its * velocity conserved, never a restart. It is deliberately NOT seekable: no * seek(), progress() or duration() - that is what `timeline()` is for. Author * with from()/fromTo() to make a run replayable (they reset the start each play). */ export interface Sequence { readonly kind: 'sequence'; readonly seekable: false; /** Resolves when the last leg rests (or on stop()). Never rejects. */ readonly finished: Promise; /** Awaitable: `await sequence` resolves when the current run finishes (delegates to `finished`). */ then: ThenFn; spring(value: Animatable, target: number, options?: SpringLegOptions): this; to(value: Animatable, target: number, options?: ToLegOptions): this; from(value: Animatable, start: number, options?: ToLegOptions): this; fromTo(value: Animatable, start: number, target: number, options?: ToLegOptions): this; decay(value: Animatable, options?: DecayLegOptions): this; /** Run an arbitrary handle as a leg. It keeps its own clock - pause/timeScale do not reach it. */ add(step: () => AnimationHandle, options?: LegOptions): this; /** Fire a callback at this point in the chain. */ call(fn: () => void, options?: LegOptions): this; /** Fan a builder across items `each` ms apart, run as one leg. */ stagger(items: readonly T[], build: (item: T, index: number) => AnimationHandle, options: StaggerLegOptions): this; /** Start (or restart from the top), or resume after pause(). */ play(): this; pause(): this; resume(): this; /** Freeze running legs, cancel pending ones, resolve finished. */ stop(): void; isPaused(): boolean; timeScale(rate: number): this; timeScale(): number; } export declare function createSequence(options?: SequenceOptions): Sequence; //# sourceMappingURL=sequence.d.ts.map