Skip to Content
Neshel-UI
Animations (experimental)Reference

@neshel-ui/animations

Every export of @neshel-ui/animations, generated from its declarations.

Experimental and not on npm

@neshel-ui/animations is a private package (0.0.0). It cannot be installed, and its API may change before a first publication. These pages document what exists in the repository.

Signatures, members and defaults, generated from the built declarations. For explanations and examples read the guide.

  • useMotionEffect function
    <Options, Resolved>(ref: RefObject<Element | null>, definition: EffectDefinition<Options, Resolved>, options?: Options | undefined, config?: AttachConfig | undefined): EffectHandle<Options> | undefined
  • useMotionValue function

    A motion value that is stable for the component's lifetime.

    (initial: number): MotionValue
  • useMotionValueEvent function

    Subscribe to a motion value without re-rendering; the latest listener is always called.

    (value: MotionValue, listener: (current: number) => void): void
  • NeshelAnimationsError class

    Error thrown for invalid effect usage; identical on the server and the client (ADR 0009 §6).

  • AttachConfig interface

    AttachConfig

    AttachConfig
    PropTypeDefaultDescription
    conflictsConflictPolicy——
    prioritynumber—Overrides the definition's priority for this attachment.
    reducedMotionReducedMotion—Overrides the policy carried by the options.
  • EffectDefinition interface

    EffectDefinition

    EffectDefinition
    PropTypeDefaultDescription
    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 reducedMotion prop).
    prioritynumber——
    reducedMotion(required)ReducedBehaviour——
    resolve(required)(options: Options | undefined) => Resolved—Validates options; throw NeshelAnimationsError for invalid input.
    setup(required)(context: EffectContext<Resolved>) => EffectInstance<Resolved>——
  • EffectHandle interface

    EffectHandle

    EffectHandle
    PropTypeDefaultDescription
    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——
  • MotionValue interface

    MotionValue

    Motion values: numbers that animate without React state (contracts/controllers.md §3).

    MotionValue
    PropTypeDefaultDescription
    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.
  • SpringOptions interface

    SpringOptions

    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
    PropTypeDefaultDescription
    dampingnumber26Damping coefficient c (default 26). c >= 2 * sqrt(k * m) never overshoots.
    massnumber1Mass m (default 1).
    restDeltanumber—Distance below which the spring may rest (default 0.01, in the value's unit).
    restSpeednumber—Speed below which the spring may rest (default 0.01 units/s).
    stiffnessnumber170Spring constant k (default 170). Higher is faster.
  • EffectState type

    `failed`: a resumed `setup()` threw; the attachment released everything and reported the error.

    "active" | "suspended" | "reduced" | "paused" | "destroyed" | "failed"
  • ReducedMotion type

    Reduced-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"
Edit on GitHub