Saltar al contenido
Neshel-UI
Animaciones (experimental)Referencia

@neshel-ui/animations/svg

Todas las exportaciones de @neshel-ui/animations/svg, 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.

  • MorphIcon component

    S04 — a decorative stroked icon morphing between named states.

    ({ shapes, state, duration, title, controlRef, ...rest }: MorphIconProps): Element
  • PathDraw component

    S01 — draw the single SVG geometry child.

    ({ children, controlRef, ...options }: PathDrawProps): Element
  • SuccessCheck component

    S10 — success checkmark (decorative by default; no role or live region is added).

    (props: SuccessCheckProps): Element
  • createChartDraw function

    S06 — draw the consumer's chart lines; reveal points as the line passes them (no charting engine).

    (svg: Element, options: ChartDrawOptions): ProgressControl
  • createCheckmark function

    S10 — draw a success checkmark (circle, then check). Adds no role or live region.

    (svg: Element, options?: CheckmarkOptions | undefined): ProgressControl
  • createDashFlow function

    S09 — marching ants: dashes flowing along paths while visible.

    (paths: Element | Iterable<Element>, options?: DashFlowOptions | undefined): LoopEffectControl
  • createGradientStops function

    S05 — animate the colours, opacities and offsets of a gradient's stops.

    (gradient: Element, options: GradientStopsOptions): LoopEffectControl
  • createIconMorph function

    S04 — morph an icon path between named states.

    (path: Element, options: IconMorphOptions): IconMorphControl
  • createLogoReveal function
    (element: Element, options?: LogoRevealOptions | undefined): ProgressControl
  • createMotionPath function
    (element: Element, options: MotionPathOptions): MotionPathControl
  • createPathDraw function

    S01 — draw one or more SVG geometry elements.

    (paths: Element | Iterable<Element>, options?: PathDrawOptions | undefined): ProgressControl
  • createPathMorph function

    S02 — morph a `<path>` between compatible shapes.

    (path: Element, options: PathMorphOptions): PathMorphControl
  • createTurbulence function

    S07 — turbulence wobble through a package SVG filter (bounded; off under reduced motion).

    (element: Element, options?: TurbulenceOptions | undefined): LoopEffectControl
  • getPathGeometry function

    Geometry of a path (`d` string or parsed commands).

    (path: string | readonly PathCommand[]): PathGeometry
  • getPathMorphCompatibility function

    Whether two paths can be morphed under the policy (parse errors propagate).

    (from: string, to: string, options?: MorphOptions | undefined): MorphCompatibility
  • getSvgDebugInfo function
    (): SvgDebugInfo
  • getSvgSupport function
    (): SvgSupport
  • interpolatePath function

    `t ↦ d` between two compatible paths; throws `NeshelAnimationsError` naming the first mismatch.

    (from: string, to: string, options?: MorphOptions | undefined): (t: number) => string
  • measurePath function

    Length in user units: native `getTotalLength()` when available and finite, else the JS geometry.

    (element: Element): number
  • parsePathData function

    Parse path data into the exact normal form (contracts/svg-geometry.md §1).

    (d: string): PathCommand[]
  • serializePathData function

    Serialise commands (absolute) rounded to `precision` decimals (0–6, default 3).

    (commands: readonly PathCommand[], precision?: number | undefined): string
  • useChartDraw function

    S06

    (ref: RefObject<Element | null>, options: ChartDrawOptions): RefObject<ProgressControl | null>
  • useDashFlow function

    S09

    (ref: RefObject<Element | null>, options?: DashFlowOptions | undefined): RefObject<LoopEffectControl | null>
  • useGradientStops function

    S05

    (ref: RefObject<Element | null>, options: GradientStopsOptions): RefObject<LoopEffectControl | null>
  • useLogoReveal function

    S08

    (ref: RefObject<Element | null>, options?: LogoRevealOptions | undefined): RefObject<ProgressControl | null>
  • useMotionPath function

    S03

    (ref: RefObject<Element | null>, options: MotionPathOptions): RefObject<MotionPathControl | null>
  • usePathDraw function

    S01

    (ref: RefObject<Element | null>, options?: PathDrawOptions | undefined): RefObject<ProgressControl | null>
  • usePathMorph function

    S02

    (ref: RefObject<Element | null>, options: PathMorphOptions): RefObject<PathMorphControl | null>
  • useTurbulence function

    S07

    (ref: RefObject<Element | null>, options?: TurbulenceOptions | undefined): RefObject<LoopEffectControl | null>
  • menuCloseShapes const

    A compatible menu ↔ close pair (24×24 viewBox, three strokes each; the middle bar becomes a diagonal).

    Readonly<{ menu: "M4 6L20 6M4 12L20 12M4 18L20 18"; close: "M6 6L18 18M6 6L18 18M6 18L18 6"; }>
  • ChartDrawOptions interface

    ChartDrawOptions

    ChartDrawOptions
    PropTipoPredeterminadoDescripción
    durationnumber—ms (0–10000; por defecto según el efecto).
    easingEasing | EasingPreset——
    lines(obligatoria)string | Element | Iterable<Element>—Elementos de línea (o un selector dentro del svg).
    onComplete(result: MotionResult) => void——
    pointsstring | Element | Iterable<Element>—Marcadores revelados cuando la línea pasa por ellos (selector o elementos).
    progressProgressSource—Se dirige con una fuente de 0 a 1 en lugar de su propio reloj.
    reducedMotionReducedMotion——
    staggernumber150ms entre líneas (por defecto 150).
    triggerProgressTrigger"visible"Por defecto "visible" (una vez); se ignora con progress.
  • CheckmarkOptions interface

    CheckmarkOptions

    CheckmarkOptions
    PropTipoPredeterminadoDescripción
    checkElementElement—Elemento de la marca (por defecto: el último path/polyline del svg).
    circlebooleantrueTraza primero el círculo (por defecto true).
    circleElementElement—Elemento del círculo (por defecto: el primer circle/path del svg cuando circle es true).
    durationnumber—ms (0–10000; por defecto según el efecto).
    easingEasing | EasingPreset——
    onComplete(result: MotionResult) => void——
    progressProgressSource—Se dirige con una fuente de 0 a 1 en lugar de su propio reloj.
    reducedMotionReducedMotion——
    triggerProgressTrigger"visible"Por defecto "visible" (una vez); se ignora con progress.
  • DashFlowOptions interface

    DashFlowOptions

    DashFlowOptions
    PropTipoPredeterminadoDescripción
    dashnumber—Longitud del guion (unidades de usuario, por defecto 6).
    durationnumber—Un ciclo, ms.
    gapnumber—Longitud del hueco (unidades de usuario, por defecto 4).
    onComplete() => void——
    reducedMotionReducedMotion——
    repeatnumber—Ciclos extra (0–1000 o Infinity, explícito).
    speednumber—Unidades por segundo; negativa invierte (−400–400; por defecto 40).
    trigger"visible" | "mount" | "manual"—visible/mount inician al crearse (por defecto); manual espera a play().
  • GradientStop interface

    GradientStop

    GradientStop
    PropTipoPredeterminadoDescripción
    colorreadonly [string, string]——
    offsetreadonly [number, number]——
    opacityreadonly [number, number]——
  • GradientStopsOptions interface

    GradientStopsOptions

    GradientStopsOptions
    PropTipoPredeterminadoDescripción
    durationnumber—Un ciclo, ms.
    onComplete() => void——
    reducedMotionReducedMotion——
    repeatnumber—Ciclos extra (0–1000 o Infinity, explícito).
    stops(obligatoria)readonly (GradientStop | undefined)[]—Por parada (según su índice entre los <stop> del degradado).
    trigger"visible" | "mount" | "manual"—visible/mount inician al crearse (por defecto); manual espera a play().
    yoyobooleantrueVa y vuelve dentro de un ciclo (por defecto true).
  • IconMorphControl interface

    IconMorphControl

    IconMorphControl
    PropTipoPredeterminadoDescripción
    cancel(obligatoria)() => void——
    destroy(obligatoria)() => void—Idempotent: stops, releases and restores.
    drive(obligatoria)(source: ProgressSource) => () => void—Follow a 0–1 source instead of the own clock; returns the unsubscribe.
    finish(obligatoria)() => void——
    finished(obligatoria)Promise<MotionResult>—Promise of the current (or next) run.
    name(obligatoria)string—The current (target) state name.
    pause(obligatoria)() => void——
    play(obligatoria)() => void——
    progress(obligatoria)number—Rendered progress 0–1.
    reverse(obligatoria)() => void——
    seek(obligatoria)(progress: number) => void—Render the effect at a time fraction 0–1 of its run (eased).
    set(obligatoria)(name: string) => Promise<unknown>——
    state(obligatoria)PathMorphControl["state"]——
    track(obligatoria)(options?: ProgressTrackOptions) => ProgressTrack—A value track for createTimeline().add(…): the timeline clock drives this effect.
  • IconMorphOptions interface

    IconMorphOptions

    IconMorphOptions
    PropTipoPredeterminadoDescripción
    durationnumber—ms (0–10000; por defecto según el efecto).
    easingEasing | EasingPreset——
    incompatible"error" | "swap"—"error" (por defecto) o "swap".
    normalize"exact" | "cubic"—"exact" (por defecto) o "cubic" (líneas y cuadráticas convertidas a cúbicas).
    onComplete(result: MotionResult) => void——
    precisionnumber3Decimales de salida 0–6 (por defecto 3).
    reducedMotionReducedMotion——
    shapes(obligatoria)Readonly<Record<string, string>>—Formas compatibles con nombre (p. ej. menuCloseShapes).
    statestring—Nombre del estado inicial (por defecto: la primera clave).
  • LogoRevealOptions interface

    LogoRevealOptions

    LogoRevealOptions
    PropTipoPredeterminadoDescripción
    durationnumber—ms (0–10000; por defecto según el efecto).
    easingEasing | EasingPreset——
    onComplete(result: MotionResult) => void——
    outlineElement | Iterable<Element>—Rutas de contorno decorativas trazadas antes de abrir la máscara.
    patternLogoRevealPattern——
    progressProgressSource—Se dirige con una fuente de 0 a 1 en lugar de su propio reloj.
    reducedMotionReducedMotion——
    softnessnumber0.15Suavidad del borde 0–0.5 (por defecto 0.15).
    triggerProgressTrigger"visible"Por defecto "visible" (una vez); se ignora con progress.
  • LoopEffectControl interface

    LoopEffectControl

    Control of a continuous effect (loop) — also seekable, timeline- and source-driven.

    LoopEffectControl
    PropTipoPredeterminadoDescripción
    destroy(obligatoria)() => void——
    drive(obligatoria)(source: ProgressSource) => () => void—Follow a 0–1 source (own clock paused); returns the unsubscribe.
    pause(obligatoria)() => void——
    play(obligatoria)() => void——
    progress(obligatoria)number—Progress 0–1 of the whole run (of one cycle when repeat is Infinity).
    seek(obligatoria)(progress: number) => void——
    state(obligatoria)LoopState——
    stop(obligatoria)() => void—Stop and show the rest state.
    track(obligatoria)(options?: ProgressTrackOptions) => ProgressTrack—A value track for createTimeline().add(…) (finite runs; one cycle when infinite).
  • LoopSvgOptions interface

    LoopSvgOptions

    LoopSvgOptions
    PropTipoPredeterminadoDescripción
    durationnumber—Un ciclo, ms.
    onComplete() => void——
    reducedMotionReducedMotion——
    repeatnumber—Ciclos extra (0–1000 o Infinity, explícito).
    trigger"visible" | "mount" | "manual"—visible/mount inician al crearse (por defecto); manual espera a play().
  • MorphOptions interface

    MorphOptions

    MorphOptions
    PropTipoPredeterminadoDescripción
    normalize"exact" | "cubic"—"exact" (por defecto) o "cubic" (líneas y cuadráticas convertidas a cúbicas).
    precisionnumber3Decimales de salida 0–6 (por defecto 3).
  • MotionPathControl interface

    MotionPathControl

    MotionPathControl
    PropTipoPredeterminadoDescripción
    cancel(obligatoria)() => void——
    destroy(obligatoria)() => void—Idempotent: stops, releases and restores.
    drive(obligatoria)(source: ProgressSource) => () => void—Follow a 0–1 source instead of the own clock; returns the unsubscribe.
    finish(obligatoria)() => void——
    finished(obligatoria)Promise<MotionResult>—Promise of the current (or next) run.
    mode(obligatoria)"native" | "js"—"native" or "js" — the mechanism actually used.
    pause(obligatoria)() => void——
    play(obligatoria)() => void——
    progress(obligatoria)number—Rendered progress 0–1.
    reverse(obligatoria)() => void——
    seek(obligatoria)(progress: number) => void—Render the effect at a time fraction 0–1 of its run (eased).
    state(obligatoria)MotionState——
    track(obligatoria)(options?: ProgressTrackOptions) => ProgressTrack—A value track for createTimeline().add(…): the timeline clock drives this effect.
  • MotionPathOptions interface

    MotionPathOptions

    MotionPathOptions
    PropTipoPredeterminadoDescripción
    durationnumber—ms (0–10000; por defecto según el efecto).
    easingEasing | EasingPreset——
    mode"auto" | "native" | "js"—"auto" (nativo si existe; por defecto), "native" o "js".
    onComplete(result: MotionResult) => void——
    path(obligatoria)string | Element—Datos de ruta en px CSS (relativos al elemento), o un <path> cuyo d se usa tal cual.
    progressProgressSource—Se dirige con una fuente de 0 a 1 en lugar de su propio reloj.
    reducedMotionReducedMotion——
    repeatnumber—Ejecuciones extra (0–1000 o Infinity, explícito).
    rotate"auto" | "reverse" | number—"auto" (tangente; por defecto), "reverse" o un ángulo fijo en grados.
    triggerProgressTrigger"visible"Por defecto "visible" (una vez); se ignora con progress.
    yoyoboolean—Alterna la dirección en las repeticiones.
  • PathDrawOptions interface

    PathDrawOptions

    PathDrawOptions
    PropTipoPredeterminadoDescripción
    durationnumber—ms (0–10000; por defecto según el efecto).
    easingEasing | EasingPreset——
    onComplete(result: MotionResult) => void——
    progressProgressSource—Se dirige con una fuente de 0 a 1 en lugar de su propio reloj.
    reducedMotionReducedMotion——
    releasebooleantrueRestaura tus estilos de guiones al completar el trazo hacia delante (por defecto true).
    reversebooleanfalseTraza desde el final hacia el inicio (por defecto false).
    staggernumber—ms entre rutas consecutivas (0–5000; por defecto 0).
    triggerProgressTrigger"visible"Por defecto "visible" (una vez); se ignora con progress.
  • PathGeometry interface

    PathGeometry

    PathGeometry
    PropTipoPredeterminadoDescripción
    bounds(obligatoria)() => { x: number; y: number; width: number; height: number; }——
    length(obligatoria)number——
    pointAt(obligatoria)(distance: number) => PathPoint——
    subpaths(obligatoria)readonly { start: number; length: number; closed: boolean; }[]——
  • PathMorphControl interface

    PathMorphControl

    PathMorphControl
    PropTipoPredeterminadoDescripción
    cancel(obligatoria)() => void——
    destroy(obligatoria)() => void—Idempotent: stops, releases and restores.
    drive(obligatoria)(source: ProgressSource) => () => void—Follow a 0–1 source instead of the own clock; returns the unsubscribe.
    finish(obligatoria)() => void——
    finished(obligatoria)Promise<MotionResult>—Promise of the current (or next) run.
    index(obligatoria)number—Index of the target shape.
    pause(obligatoria)() => void——
    play(obligatoria)() => void——
    progress(obligatoria)number—Rendered progress 0–1.
    reverse(obligatoria)() => void——
    seek(obligatoria)(progress: number) => void—Render the effect at a time fraction 0–1 of its run (eased).
    state(obligatoria)MotionState——
    to(obligatoria)(index: number) => Promise<unknown>—Morph to a shape.
    track(obligatoria)(options?: ProgressTrackOptions) => ProgressTrack—A value track for createTimeline().add(…): the timeline clock drives this effect.
    trackTo(obligatoria)(index: number, options?: { id?: string; duration?: number; }) => ReturnType<ProgressControl["track"]>—Value track morphing from the current shape to index inside a C01 timeline.
  • PathMorphOptions interface

    PathMorphOptions

    PathMorphOptions
    PropTipoPredeterminadoDescripción
    durationnumber—ms (0–10000; por defecto según el efecto).
    easingEasing | EasingPreset——
    incompatible"error" | "swap"—"error" (por defecto) o "swap".
    initialnumber—Índice mostrado al crear (por defecto 0; el d de la ruta no cambia hasta que empieza una transformación).
    normalize"exact" | "cubic"—"exact" (por defecto) o "cubic" (líneas y cuadráticas convertidas a cúbicas).
    onComplete(result: MotionResult) => void——
    precisionnumber3Decimales de salida 0–6 (por defecto 3).
    reducedMotionReducedMotion——
    shapes(obligatoria)readonly string[]—Las formas (datos de ruta), compatibles entre sí.
  • PathPoint interface

    PathPoint

    PathPoint
    PropTipoPredeterminadoDescripción
    angle(obligatoria)number—Tangent direction in degrees.
    x(obligatoria)number——
    y(obligatoria)number——
  • ProgressControl interface

    ProgressControl

    ProgressControl
    PropTipoPredeterminadoDescripción
    cancel(obligatoria)() => void——
    destroy(obligatoria)() => void—Idempotent: stops, releases and restores.
    drive(obligatoria)(source: ProgressSource) => () => void—Follow a 0–1 source instead of the own clock; returns the unsubscribe.
    finish(obligatoria)() => void——
    finished(obligatoria)Promise<MotionResult>—Promise of the current (or next) run.
    pause(obligatoria)() => void——
    play(obligatoria)() => void——
    progress(obligatoria)number—Rendered progress 0–1.
    reverse(obligatoria)() => void——
    seek(obligatoria)(progress: number) => void—Render the effect at a time fraction 0–1 of its run (eased).
    state(obligatoria)MotionState——
    track(obligatoria)(options?: ProgressTrackOptions) => ProgressTrack—A value track for createTimeline().add(…): the timeline clock drives this effect.
  • ProgressSource interface

    ProgressSource

    Any 0–1 progress source (the 011 ScrollProgress and motion values fit).

    ProgressSource
    PropTipoPredeterminadoDescripción
    get(obligatoria)() => number——
    subscribe(obligatoria)(listener: (progress: number) => void) => () => void——
  • SvgDebugInfo interface

    SvgDebugInfo

    SvgDebugInfo
    PropTipoPredeterminadoDescripción
    attributeWrites(obligatoria)number——
    effects(obligatoria)number——
    filters(obligatoria)number——
    measures(obligatoria)number——
    morphs(obligatoria)number——
  • SvgSupport interface

    SvgSupport

    SvgSupport
    PropTipoPredeterminadoDescripción
    colorMix(obligatoria)boolean——
    cssD(obligatoria)boolean——
    mask(obligatoria)boolean——
    offsetPath(obligatoria)boolean——
  • TurbulenceOptions interface

    TurbulenceOptions

    TurbulenceOptions
    PropTipoPredeterminadoDescripción
    amplitudenumber6Desplazamiento en px 0–24 (por defecto 6).
    durationnumber—Un ciclo, ms.
    frequencynumber0.02Frecuencia base 0.001–0.2 (por defecto 0.02).
    octavesnumber1Octavas 1–3 (por defecto 1).
    onComplete() => void——
    ratenumber20Actualizaciones del filtro por segundo 1–30 (por defecto 20).
    reducedMotionReducedMotion——
    regionnumber0.1Margen de la región del filtro 0–0.25 (por defecto 0.1).
    repeatnumber—Ciclos extra (0–1000 o Infinity, explícito).
    speednumber0.5Oscilación de la frecuencia, ciclos por segundo 0–2 (por defecto 0.5).
    trigger"visible" | "mount" | "manual"—visible/mount inician al crearse (por defecto); manual espera a play().
  • LogoRevealPattern type
    "wipe-right" | "wipe-left" | "wipe-up" | "wipe-down" | "circle"
  • MorphCompatibility type

    MorphCompatibility

    MorphCompatibility
    PropTipoPredeterminadoDescripción
    compatible(obligatoria)boolean——
    index(obligatoria)number——
    reason(obligatoria)string——
  • MorphIconProps type

    MorphIconProps

    MorphIconProps
    PropTipoPredeterminadoDescripción
    controlRefRefObject<IconMorphControl | null>——
    durationnumber——
    shapes(obligatoria)Readonly<Record<string, string>>—Named compatible shapes in a 24×24 viewBox (e.g. menuCloseShapes).
    state(obligatoria)string——
    titlestring—Accessible title: omitted → decorative (aria-hidden); name the button instead.

    También acepta las props de: React DOM attributes.

  • PathCommand type

    PathCommand

    PathCommand
    PropTipoPredeterminadoDescripción
    angle(obligatoria)number——
    large(obligatoria)boolean——
    rx(obligatoria)number——
    ry(obligatoria)number——
    sweep(obligatoria)boolean——
    type(obligatoria)"M" | "L" | "C" | "Q" | "A" | "Z"——
    x(obligatoria)number——
    x1(obligatoria)number——
    x2(obligatoria)number——
    y(obligatoria)number——
    y1(obligatoria)number——
    y2(obligatoria)number——
  • PathDrawProps type

    PathDrawProps

    PathDrawProps
    PropTipoPredeterminadoDescripción
    children(obligatoria)ReactElement—One SVG geometry element (<path>, <circle>, …).
    controlRefRefObject<ProgressControl | null>——
    durationnumber—ms (0–10000; por defecto según el efecto).
    easingEasing | EasingPreset——
    onComplete(result: MotionResult) => void——
    progressProgressSource—Se dirige con una fuente de 0 a 1 en lugar de su propio reloj.
    reducedMotionReducedMotion——
    releasebooleantrueRestaura tus estilos de guiones al completar el trazo hacia delante (por defecto true).
    reversebooleanfalseTraza desde el final hacia el inicio (por defecto false).
    staggernumber—ms entre rutas consecutivas (0–5000; por defecto 0).
    triggerProgressTrigger"visible"Por defecto "visible" (una vez); se ignora con progress.
  • SuccessCheckProps type

    SuccessCheckProps

    SuccessCheckProps
    PropTipoPredeterminadoDescripción
    circlebooleantrueTraza primero el círculo (por defecto true).
    controlRefRefObject<ProgressControl | null>——
    durationnumber—ms (0–10000; por defecto según el efecto).
    easingEasing | EasingPreset——
    onComplete(result: MotionResult) => void——
    progressProgressSource—Se dirige con una fuente de 0 a 1 en lugar de su propio reloj.
    reducedMotionReducedMotion——
    sizenumber——
    titlestring—Accessible title: omitted → decorative (aria-hidden); announce success in your own status text.
    triggerProgressTrigger"visible"Por defecto "visible" (una vez); se ignora con progress.

    También acepta las props de: React DOM attributes.

  • SvgEffectOptions type

    SvgEffectOptions

    SvgEffectOptions
    PropTipoPredeterminadoDescripción
    durationnumber—ms (0–10000; por defecto según el efecto).
    easingEasing | EasingPreset——
    onComplete(result: MotionResult) => void——
    progressProgressSource—Se dirige con una fuente de 0 a 1 en lugar de su propio reloj.
    reducedMotionReducedMotion——
    triggerProgressTrigger"visible"Por defecto "visible" (una vez); se ignora con progress.
  • SvgTrigger type
    ProgressTrigger
Editar en GitHub