/** * Micro-interaction effects: magnetic, tilt, shake, pulse, countUp. * * All effects respect `prefers-reduced-motion` by default and degrade * gracefully when DOM/animation APIs are unavailable. * * @module bquery/motion */ import type { EasingFunction } from './types'; /** Cleanup function for stateful effects like {@link magnetic} and {@link tilt}. */ export type EffectCleanup = () => void; /** * Options for {@link magnetic}. */ export interface MagneticOptions { /** Pull strength (0..1, default 0.3). */ strength?: number; /** Pixel radius for pointer attraction (default 80). */ radius?: number; /** Whether to respect prefers-reduced-motion (default true). */ respectReducedMotion?: boolean; } /** * Apply a pointer-following micro-interaction to an element. The element * is translated toward the pointer when it is within `radius` pixels of * the element's center. * * @returns Cleanup function that detaches listeners and resets transforms. */ export declare const magnetic: (element: Element, options?: MagneticOptions) => EffectCleanup; /** * Options for {@link tilt}. */ export interface TiltOptions { /** Maximum tilt angle in degrees (default 15). */ max?: number; /** Perspective in pixels for the CSS `perspective()` (default 800). */ perspective?: number; /** Scale applied on hover (default 1). */ scale?: number; /** Whether to respect prefers-reduced-motion (default true). */ respectReducedMotion?: boolean; } /** * Apply a 3D pointer-driven tilt effect to an element. The element rotates * around its X/Y axes toward the pointer position relative to its center. * * @returns Cleanup function that detaches listeners and resets transforms. */ export declare const tilt: (element: Element, options?: TiltOptions) => EffectCleanup; /** * Options for {@link shake}. */ export interface ShakeOptions { /** Total duration in milliseconds (default 400). */ duration?: number; /** Maximum displacement in pixels (default 8). */ intensity?: number; /** Direction of shake (default 'horizontal'). */ direction?: 'horizontal' | 'vertical' | 'both'; /** Whether to respect prefers-reduced-motion (default true). */ respectReducedMotion?: boolean; } /** * Quick attention-grabbing shake animation. Returns a Promise that resolves * when the animation completes (or immediately when reduced motion is active). */ export declare const shake: (element: Element, options?: ShakeOptions) => Promise; /** * Options for {@link pulse}. */ export interface PulseOptions { /** Single-pulse duration in milliseconds (default 500). */ duration?: number; /** Peak scale factor at the pulse apex (default 1.08). */ scale?: number; /** Number of pulses (default 1). */ iterations?: number; /** Whether to respect prefers-reduced-motion (default true). */ respectReducedMotion?: boolean; } /** * Pulse/heartbeat animation using a scale-up, scale-down cycle. Returns a * Promise that resolves when all iterations complete. */ export declare const pulse: (element: Element, options?: PulseOptions) => Promise; /** * Options for {@link countUp}. */ export interface CountUpOptions { /** Total duration in milliseconds (default 1000). */ duration?: number; /** Easing curve (default `easeOutCubic`). */ easing?: EasingFunction; /** * Number of decimal places to render. If omitted, integer rendering is * used when both `from` and `to` are integers; otherwise two decimals. */ decimals?: number; /** Custom formatter — overrides `decimals` when provided. */ format?: (value: number) => string; /** Optional prefix appended before the value. */ prefix?: string; /** Optional suffix appended after the value. */ suffix?: string; /** Whether to respect prefers-reduced-motion (default true). */ respectReducedMotion?: boolean; /** Optional `AbortSignal` for cancellation. */ signal?: AbortSignal; } /** * Animated numeric counter. Writes the interpolated value into * `element.textContent` on every frame, optionally prefixed/suffixed/formatted. */ export declare const countUp: (element: Element, from: number, to: number, options?: CountUpOptions) => Promise; //# sourceMappingURL=effects.d.ts.map