import type { ElementRect } from "../rect.js"; import type { Effect, EffectContext, EffectDims, EffectRenderTarget } from "../types.js"; import type { TransitionEase, TransitionEffect, TransitionProgress, TransitionRun } from "./types.js"; export type TransitionStartOpts = { /** Seconds. Above 0. */ duration: number; /** Defaults to `"smoothstep"`. */ ease?: TransitionEase; /** Called once when this run finishes or is replaced. */ onEnd?(): void; }; /** What the transition effects of a run see. Null while idle. */ export type TransitionFrame = { from: EffectRenderTarget; progress: TransitionProgress; /** True while the old content is held, before the animation. */ holding: boolean; }; /** * First effect of every transition chain. States: * - idle: disabled, the chain passes the capture through. * - hold: shows the snapshot of the old content while the new one is captured. * - playing: disabled, so the live capture goes to the transition effects; it only keeps time. */ export declare class TransitionStage implements Effect { #private; enabled: boolean; /** Copy the current capture into `from` on the next frame and hold it on screen. */ snapshot(): Promise; /** Resolves when the transition ends or another one replaces it. */ start(spec: TransitionStartOpts): Promise; /** Stop any transition, drop a pending snapshot and pass the capture through. */ cancel(): void; get frame(): TransitionFrame | null; /** End the playing run now; the live capture shows from this frame on. */ cut(): void; update(ctx: EffectContext): void; render(ctx: EffectContext): void; dispose(): void; } export type TransitionFrameSource = { readonly frame: TransitionFrame | null; cut(): void; }; /** * Puts a `TransitionEffect` in the chain. * Skipped outside a run; during one it passes the run state on the context. */ export declare class TransitionSlot implements Effect { #private; readonly effect: TransitionEffect; constructor(effect: TransitionEffect, source: TransitionFrameSource); get enabled(): boolean; start(run: TransitionRun): void; end(): void; init(ctx: EffectContext): void | Promise; update(ctx: EffectContext): void; render(ctx: EffectContext): void; outputRect(dims: EffectDims): ElementRect | undefined; dispose(): void; }