UNPKG

resig.js

Version:

Universal reactive signal library with complete platform features: signals, animations, CRDTs, scheduling, DOM integration. Works identically across React, SolidJS, Svelte, Vue, and Qwik.

38 lines (37 loc) 1.6 kB
/** * Animation Composition System - Operadic Composition * Following category-theoretic principles for animation composition */ import { Signal } from '../core/signal'; import { Animation } from './core'; export interface ParallelAnimation<T, U> extends Animation<T & U> { readonly first: Animation<T>; readonly second: Animation<U>; } export interface SequentialAnimation<T, U> extends Animation<T | U> { readonly first: Animation<T>; readonly second: Animation<U>; readonly currentPhase: Signal<'first' | 'second' | 'complete'>; } export interface Timeline { readonly id: string; readonly duration: number; readonly progress: Signal<number>; readonly isComplete: Signal<boolean>; readonly animations: Array<{ animation: Animation<any>; offset: number; }>; readonly add: <T>(animation: Animation<T>, offset?: number) => Timeline; readonly remove: (animationId: string) => Timeline; readonly start: () => void; readonly pause: () => void; readonly resume: () => void; readonly stop: () => void; readonly seek: (progress: number) => void; } export declare const parallel: <T, U>(anim1: Animation<T>, anim2: Animation<U>) => ParallelAnimation<T, U>; export declare const sequence: <T, U>(first: Animation<T>, second: Animation<U>) => SequentialAnimation<T, U>; export declare const timeline: () => Timeline; export declare const stagger: <T>(animations: Animation<T>[], staggerDelay: number) => Timeline; export declare const repeat: <T>(animation: Animation<T>, count: number, delay?: number) => Timeline;