UNPKG

@laubloch/scrolly-motion

Version:

Advanced scroll animation library with breakpoint support, timeline presets.

84 lines (83 loc) 2.22 kB
/** * Modular ScrollyMotion * A version of ScrollyMotion that accepts modules as constructor parameters */ import type { ScrollAnimatorConfig, ScrollElement } from "../types/index.js"; import type { ScrollyMotionModule, ScrollyMotionCore } from "../modules/ModuleInterface.js"; export declare class ModularScrollyMotion implements ScrollyMotionCore { private config; private modules; private elements; private activeElements; private eventManager; private intersectionObserver; private isInitialized; private debouncedUpdate; constructor(modules?: (() => ScrollyMotionModule)[], config?: Partial<ScrollAnimatorConfig>); /** * Initialize modules */ private initializeModules; /** * Initialize the library */ init(): void; /** * Discover and parse elements */ private discoverElements; /** * Initialize element with default properties */ private initializeElement; /** * Setup intersection observer */ private setupIntersectionObserver; /** * Setup event listeners */ private setupEventListeners; /** * Update all active elements */ private updateElements; /** * Calculate scroll progress for an element */ private calculateProgress; /** * Destroy the instance */ destroy(): void; /** * Event system methods (implementing ScrollyMotionCore interface) */ on(eventName: string, handler: (...args: any[]) => void): void; off(eventName: string, handler: (...args: any[]) => void): void; emit(eventName: string, ...args: any[]): void; /** * Get active elements */ getActiveElements(): ScrollElement[]; /** * Get all elements */ getAllElements(): ScrollElement[]; /** * Get elements (alias for getAllElements to match interface) */ getElements(): ScrollElement[]; /** * Add a module dynamically */ addModule(moduleFactory: () => ScrollyMotionModule): void; /** * Remove a module */ removeModule(moduleName: string): void; /** * Get loaded modules */ getModules(): ScrollyMotionModule[]; }