Saltar al contenido
Neshel-UI
Animaciones (experimental)Referencia

@neshel-ui/animations

Todas las exportaciones de @neshel-ui/animations, generadas desde sus declaraciones.

Experimental y no disponible en npm

@neshel-ui/animations es un paquete privado (0.0.0). No se puede instalar y su API puede cambiar antes de una primera publicación. Estas páginas documentan lo que existe en el repositorio.

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.

  • 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
    PropTipoPredeterminadoDescripción
    conflictsConflictPolicy——
    prioritynumber—Overrides the definition's priority for this attachment.
    reducedMotionReducedMotion—Overrides the policy carried by the options.
  • EffectDefinition interface

    EffectDefinition

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

    EffectHandle

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

    MotionValue

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

    MotionValue
    PropTipoPredeterminadoDescripció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.
  • 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
    PropTipoPredeterminadoDescripción
    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"
Editar en GitHub