@laubloch/scrolly-motion
Version:
Advanced scroll animation library with breakpoint support, timeline presets.
72 lines (71 loc) • 2.03 kB
TypeScript
/**
* ScrollyMotion Types
* All TypeScript interfaces and type definitions
*/
export interface ScrollAnimatorConfig {
selector?: string;
breakpoints?: Record<string, string>;
presets?: Record<string, TimelineStep[]>;
defaultEnter?: string;
}
export interface AnimationConfig {
from: Record<string, any>;
to: Record<string, any>;
timeline?: TimelineStep[];
breakpoint?: string;
transitionDuration?: number;
transitionEasing?: string;
}
export interface StaggerConfig {
selector: string;
from: Record<string, any>;
to: Record<string, any>;
staggerDelay: number;
timeline?: TimelineStep[];
breakpoint?: string;
transitionDuration?: number;
transitionEasing?: string;
}
export interface MultiBreakpointStaggerConfig {
[breakpoint: string]: StaggerConfig;
}
export interface BreakpointAnimationConfig {
[breakpoint: string]: AnimationConfig;
}
export interface TimelineStep {
at: number;
properties: Record<string, any>;
duration?: number;
}
export interface TimelinePreset {
name: string;
steps: TimelineStep[];
}
export interface ScrollElement extends HTMLElement {
_enterAt: number;
_distance: number;
_exitAt: number;
_once: boolean;
_enterClassNames: string[];
_leaveClassNames: string[];
_theme: string | null;
_wcElements: HTMLElement[];
_webComponents: string | null;
_lastProg: number | null;
_animationConfig: AnimationConfig | null;
_animeInstance: any | null;
_targetProgress: number;
_currentProgress: number;
_staggerConfig: StaggerConfig | null;
_multiStaggerConfig: MultiBreakpointStaggerConfig | null;
_staggerChildren: HTMLElement[];
_hasEnteredOnce: boolean;
_hasStartedAnimating: boolean;
}
export type DebouncedFunction<T extends (...args: any[]) => void> = (...args: Parameters<T>) => void;
export interface ScrollyMotionMetrics {
fps: number;
activeElements: number;
memoryUsage: number;
gpuAccelerated: boolean;
}