@neshel-ui/animations
Every export of @neshel-ui/animations, generated from its declarations.
Experimental and not on npm
Signatures, members and defaults, generated from the built declarations. For explanations and examples read the guide.
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 Type Default Description conflicts ConflictPolicy— — priority number— Overrides the definition's priority for this attachment. reducedMotion ReducedMotion— Overrides the policy carried by the options. EffectDefinitioninterfaceEffectDefinition
EffectDefinition Prop Type Default Description channels(required) readonly ChannelClaim[]— — family(required) FamilyId— — id(required) EffectId— — policy (options: Resolved) => ReducedMotion | undefined— Reduced-motion policy carried by the options (e.g. Tilt3D's reducedMotionprop).priority number— — reducedMotion(required) ReducedBehaviour— — resolve(required) (options: Options | undefined) => Resolved— Validates options; throw NeshelAnimationsErrorfor invalid input.setup(required) (context: EffectContext<Resolved>) => EffectInstance<Resolved>— — EffectHandleinterfaceEffectHandle
EffectHandle Prop Type Default Description destroy(required) () => void— Idempotent; releases channels (restoring styles) and every listener. pause(required) () => void— — resume(required) () => void— — state(required) EffectState— — update(required) (options?: Options) => void— — MotionValueinterfaceMotionValue
Motion values: numbers that animate without React state (contracts/controllers.md §3).
MotionValue Prop Type Default Description get(required) () => number— — getVelocity(required) () => number— — set(required) (value: number) => void— Set directly (velocity becomes 0); interrupts nothing by itself. subscribe(required) (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 Type Default Description 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"