@neshel-ui/animations
Todas las exportaciones de @neshel-ui/animations, generadas desde sus declaraciones.
Experimental y no disponible en npm
Firmas, miembros y valores por defecto, generados desde las declaraciones compiladas. Las explicaciones y los ejemplos están en la guía.
Las descripciones de esta referencia se generan desde el código fuente del paquete y se muestran en inglés; las guías y el catálogo están en español.
useMotionEffectfunction<Options, Resolved>(ref: RefObject<Element | null>, definition: EffectDefinition<Options, Resolved>, options?: Options | undefined, config?: AttachConfig | undefined): EffectHandle<Options> | undefineduseMotionValuefunctionA motion value that is stable for the component's lifetime.
(initial: number): MotionValueuseMotionValueEventfunctionSubscribe to a motion value without re-rendering; the latest listener is always called.
(value: MotionValue, listener: (current: number) => void): voidNeshelAnimationsErrorclassError thrown for invalid effect usage; identical on the server and the client (ADR 0009 §6).
AttachConfiginterfaceAttachConfig
AttachConfig Prop Tipo Predeterminado Descripción conflicts ConflictPolicy— — priority number— Overrides the definition's priority for this attachment. reducedMotion ReducedMotion— Overrides the policy carried by the options. EffectDefinitioninterfaceEffectDefinition
EffectDefinition Prop Tipo Predeterminado Descripción channels(obligatoria) readonly ChannelClaim[]— — family(obligatoria) FamilyId— — id(obligatoria) EffectId— — policy (options: Resolved) => ReducedMotion | undefined— Reduced-motion policy carried by the options (e.g. Tilt3D's reducedMotionprop).priority number— — reducedMotion(obligatoria) ReducedBehaviour— — resolve(obligatoria) (options: Options | undefined) => Resolved— Validates options; throw NeshelAnimationsErrorfor invalid input.setup(obligatoria) (context: EffectContext<Resolved>) => EffectInstance<Resolved>— — EffectHandleinterfaceEffectHandle
EffectHandle Prop Tipo Predeterminado Descripción destroy(obligatoria) () => void— Idempotent; releases channels (restoring styles) and every listener. pause(obligatoria) () => void— — resume(obligatoria) () => void— — state(obligatoria) EffectState— — update(obligatoria) (options?: Options) => void— — MotionValueinterfaceMotionValue
Motion values: numbers that animate without React state (contracts/controllers.md §3).
MotionValue Prop Tipo Predeterminado Descripción get(obligatoria) () => number— — getVelocity(obligatoria) () => number— — set(obligatoria) (value: number) => void— Set directly (velocity becomes 0); interrupts nothing by itself. subscribe(obligatoria) (listener: (value: number) => void) => () => void— Listener runs synchronously on every change; returns the unsubscribe function. SpringOptionsinterfaceSpringOptions
Damped spring integrator (contracts/core-engine.md §2). Pure and framework-agnostic: the caller owns the state object and the clock. Semi-implicit Euler with fixed sub-steps (at most 1/240 s) keeps the integration stable for any frame rate; the spring snaps to its target once both the distance and the speed fall below the rest thresholds, so an idle effect stops scheduling frames.
SpringOptions Prop Tipo Predeterminado Descripción damping number26Damping coefficient c (default 26). c >= 2 * sqrt(k * m)never overshoots.mass number1Mass m (default 1). restDelta number— Distance below which the spring may rest (default 0.01, in the value's unit). restSpeed number— Speed below which the spring may rest (default 0.01 units/s). stiffness number170Spring constant k (default 170). Higher is faster. EffectStatetype`failed`: a resumed `setup()` threw; the attachment released everything and reported the error.
"active" | "suspended" | "reduced" | "paused" | "destroyed" | "failed"ReducedMotiontypeReduced-motion policy (contracts/accessibility.md, constitution IV). - `"user"` (default everywhere): follow `prefers-reduced-motion`. - `"always"`: always use the reduced variant (e.g. an application-level "reduce motion" setting). - `"never"`: ignore the preference. Reserved for motion essential to the meaning (WCAG 2.3.3); effects in this package never default to it.
"user" | "always" | "never"