Skip to Content
Neshel-UI
Animations (experimental)Reference

@neshel-ui/animations/svg

Every export of @neshel-ui/animations/svg, 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.

  • 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
    PropTypeDefaultDescription
    durationnumber—ms (0–10000; default per effect).
    easingEasing | EasingPreset——
    lines(required)string | Element | Iterable<Element>—Line elements (or a selector inside the svg).
    onComplete(result: MotionResult) => void——
    pointsstring | Element | Iterable<Element>—Point markers revealed when the line passes them (selector or elements).
    progressProgressSource—Drive from a 0–1 source instead of the own clock.
    reducedMotionReducedMotion——
    staggernumber150ms between lines (default 150).
    triggerProgressTrigger"visible"Default "visible" (once); ignored with progress.
  • CheckmarkOptions interface

    CheckmarkOptions

    CheckmarkOptions
    PropTypeDefaultDescription
    checkElementElement—Check element (default: the last path/polyline in the svg).
    circlebooleantrueDraw the circle first (default true).
    circleElementElement—Circle element (default: the first circle/path in the svg when circle is true).
    durationnumber—ms (0–10000; default per effect).
    easingEasing | EasingPreset——
    onComplete(result: MotionResult) => void——
    progressProgressSource—Drive from a 0–1 source instead of the own clock.
    reducedMotionReducedMotion——
    triggerProgressTrigger"visible"Default "visible" (once); ignored with progress.
  • DashFlowOptions interface

    DashFlowOptions

    DashFlowOptions
    PropTypeDefaultDescription
    dashnumber—Dash length (user units, default 6).
    durationnumber—One cycle, ms.
    gapnumber—Gap length (user units, default 4).
    onComplete() => void——
    reducedMotionReducedMotion——
    repeatnumber—Extra cycles (0–1000 or Infinity, explicit).
    speednumber—Units per second, negative reverses (−400–400; default 40).
    trigger"visible" | "mount" | "manual"—visible/mount start on creation (default); manual waits for play().
  • GradientStop interface

    GradientStop

    GradientStop
    PropTypeDefaultDescription
    colorreadonly [string, string]——
    offsetreadonly [number, number]——
    opacityreadonly [number, number]——
  • GradientStopsOptions interface

    GradientStopsOptions

    GradientStopsOptions
    PropTypeDefaultDescription
    durationnumber—One cycle, ms.
    onComplete() => void——
    reducedMotionReducedMotion——
    repeatnumber—Extra cycles (0–1000 or Infinity, explicit).
    stops(required)readonly (GradientStop | undefined)[]—Per stop (by index among the gradient's <stop> children).
    trigger"visible" | "mount" | "manual"—visible/mount start on creation (default); manual waits for play().
    yoyobooleantrueAlternate back and forth inside a cycle (default true).
  • IconMorphControl interface

    IconMorphControl

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

    IconMorphOptions

    IconMorphOptions
    PropTypeDefaultDescription
    durationnumber—ms (0–10000; default per effect).
    easingEasing | EasingPreset——
    incompatible"error" | "swap"—"error" (default) or "swap".
    normalize"exact" | "cubic"—"exact" (default) or "cubic" (lines and quadratics promoted to cubics).
    onComplete(result: MotionResult) => void——
    precisionnumber3Output decimals 0–6 (default 3).
    reducedMotionReducedMotion——
    shapes(required)Readonly<Record<string, string>>—Named compatible shapes (e.g. menuCloseShapes).
    statestring—Initial state name (default: the first key).
  • LogoRevealOptions interface

    LogoRevealOptions

    LogoRevealOptions
    PropTypeDefaultDescription
    durationnumber—ms (0–10000; default per effect).
    easingEasing | EasingPreset——
    onComplete(result: MotionResult) => void——
    outlineElement | Iterable<Element>—Decorative outline paths drawn before the mask opens.
    patternLogoRevealPattern——
    progressProgressSource—Drive from a 0–1 source instead of the own clock.
    reducedMotionReducedMotion——
    softnessnumber0.15Edge softness 0–0.5 (default 0.15).
    triggerProgressTrigger"visible"Default "visible" (once); ignored with progress.
  • LoopEffectControl interface

    LoopEffectControl

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

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

    LoopSvgOptions

    LoopSvgOptions
    PropTypeDefaultDescription
    durationnumber—One cycle, ms.
    onComplete() => void——
    reducedMotionReducedMotion——
    repeatnumber—Extra cycles (0–1000 or Infinity, explicit).
    trigger"visible" | "mount" | "manual"—visible/mount start on creation (default); manual waits for play().
  • MorphOptions interface

    MorphOptions

    MorphOptions
    PropTypeDefaultDescription
    normalize"exact" | "cubic"—"exact" (default) or "cubic" (lines and quadratics promoted to cubics).
    precisionnumber3Output decimals 0–6 (default 3).
  • MotionPathControl interface

    MotionPathControl

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

    MotionPathOptions

    MotionPathOptions
    PropTypeDefaultDescription
    durationnumber—ms (0–10000; default per effect).
    easingEasing | EasingPreset——
    mode"auto" | "native" | "js"—"auto" (native when supported; default), "native" or "js".
    onComplete(result: MotionResult) => void——
    path(required)string | Element—Path data in CSS px (element-relative), or a <path> whose d is used as is.
    progressProgressSource—Drive from a 0–1 source instead of the own clock.
    reducedMotionReducedMotion——
    repeatnumber—Extra runs (0–1000 or Infinity, explicit).
    rotate"auto" | "reverse" | number—"auto" (tangent; default), "reverse", or a fixed angle in degrees.
    triggerProgressTrigger"visible"Default "visible" (once); ignored with progress.
    yoyoboolean—Alternate direction on repeats.
  • PathDrawOptions interface

    PathDrawOptions

    PathDrawOptions
    PropTypeDefaultDescription
    durationnumber—ms (0–10000; default per effect).
    easingEasing | EasingPreset——
    onComplete(result: MotionResult) => void——
    progressProgressSource—Drive from a 0–1 source instead of the own clock.
    reducedMotionReducedMotion——
    releasebooleantrueRestore the consumer's dash styles when the draw completes forwards (default true).
    reversebooleanfalseDraw from the end towards the start (default false).
    staggernumber—ms between consecutive paths (0–5000; default 0).
    triggerProgressTrigger"visible"Default "visible" (once); ignored with progress.
  • PathGeometry interface

    PathGeometry

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

    PathMorphControl

    PathMorphControl
    PropTypeDefaultDescription
    cancel(required)() => void——
    destroy(required)() => void—Idempotent: stops, releases and restores.
    drive(required)(source: ProgressSource) => () => void—Follow a 0–1 source instead of the own clock; returns the unsubscribe.
    finish(required)() => void——
    finished(required)Promise<MotionResult>—Promise of the current (or next) run.
    index(required)number—Index of the target shape.
    pause(required)() => void——
    play(required)() => void——
    progress(required)number—Rendered progress 0–1.
    reverse(required)() => void——
    seek(required)(progress: number) => void—Render the effect at a time fraction 0–1 of its run (eased).
    state(required)MotionState——
    to(required)(index: number) => Promise<unknown>—Morph to a shape.
    track(required)(options?: ProgressTrackOptions) => ProgressTrack—A value track for createTimeline().add(…): the timeline clock drives this effect.
    trackTo(required)(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
    PropTypeDefaultDescription
    durationnumber—ms (0–10000; default per effect).
    easingEasing | EasingPreset——
    incompatible"error" | "swap"—"error" (default) or "swap".
    initialnumber—Index shown at creation (default 0; the path's d is not changed until a morph starts).
    normalize"exact" | "cubic"—"exact" (default) or "cubic" (lines and quadratics promoted to cubics).
    onComplete(result: MotionResult) => void——
    precisionnumber3Output decimals 0–6 (default 3).
    reducedMotionReducedMotion——
    shapes(required)readonly string[]—The shapes (path data), all compatible with each other.
  • PathPoint interface

    PathPoint

    PathPoint
    PropTypeDefaultDescription
    angle(required)number—Tangent direction in degrees.
    x(required)number——
    y(required)number——
  • ProgressControl interface

    ProgressControl

    ProgressControl
    PropTypeDefaultDescription
    cancel(required)() => void——
    destroy(required)() => void—Idempotent: stops, releases and restores.
    drive(required)(source: ProgressSource) => () => void—Follow a 0–1 source instead of the own clock; returns the unsubscribe.
    finish(required)() => void——
    finished(required)Promise<MotionResult>—Promise of the current (or next) run.
    pause(required)() => void——
    play(required)() => void——
    progress(required)number—Rendered progress 0–1.
    reverse(required)() => void——
    seek(required)(progress: number) => void—Render the effect at a time fraction 0–1 of its run (eased).
    state(required)MotionState——
    track(required)(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
    PropTypeDefaultDescription
    get(required)() => number——
    subscribe(required)(listener: (progress: number) => void) => () => void——
  • SvgDebugInfo interface

    SvgDebugInfo

    SvgDebugInfo
    PropTypeDefaultDescription
    attributeWrites(required)number——
    effects(required)number——
    filters(required)number——
    measures(required)number——
    morphs(required)number——
  • SvgSupport interface

    SvgSupport

    SvgSupport
    PropTypeDefaultDescription
    colorMix(required)boolean——
    cssD(required)boolean——
    mask(required)boolean——
    offsetPath(required)boolean——
  • TurbulenceOptions interface

    TurbulenceOptions

    TurbulenceOptions
    PropTypeDefaultDescription
    amplitudenumber6Displacement in px 0–24 (default 6).
    durationnumber—One cycle, ms.
    frequencynumber0.02Base frequency 0.001–0.2 (default 0.02).
    octavesnumber1Octaves 1–3 (default 1).
    onComplete() => void——
    ratenumber20Filter updates per second 1–30 (default 20).
    reducedMotionReducedMotion——
    regionnumber0.1Filter region padding 0–0.25 (default 0.1).
    repeatnumber—Extra cycles (0–1000 or Infinity, explicit).
    speednumber0.5Frequency oscillation, cycles per second 0–2 (default 0.5).
    trigger"visible" | "mount" | "manual"—visible/mount start on creation (default); manual waits for play().
  • LogoRevealPattern type
    "wipe-right" | "wipe-left" | "wipe-up" | "wipe-down" | "circle"
  • MorphCompatibility type

    MorphCompatibility

    MorphCompatibility
    PropTypeDefaultDescription
    compatible(required)boolean——
    index(required)number——
    reason(required)string——
  • MorphIconProps type

    MorphIconProps

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

    Also accepts the props of: React DOM attributes.

  • PathCommand type

    PathCommand

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

    PathDrawProps

    PathDrawProps
    PropTypeDefaultDescription
    children(required)ReactElement—One SVG geometry element (<path>, <circle>, …).
    controlRefRefObject<ProgressControl | null>——
    durationnumber—ms (0–10000; default per effect).
    easingEasing | EasingPreset——
    onComplete(result: MotionResult) => void——
    progressProgressSource—Drive from a 0–1 source instead of the own clock.
    reducedMotionReducedMotion——
    releasebooleantrueRestore the consumer's dash styles when the draw completes forwards (default true).
    reversebooleanfalseDraw from the end towards the start (default false).
    staggernumber—ms between consecutive paths (0–5000; default 0).
    triggerProgressTrigger"visible"Default "visible" (once); ignored with progress.
  • SuccessCheckProps type

    SuccessCheckProps

    SuccessCheckProps
    PropTypeDefaultDescription
    circlebooleantrueDraw the circle first (default true).
    controlRefRefObject<ProgressControl | null>——
    durationnumber—ms (0–10000; default per effect).
    easingEasing | EasingPreset——
    onComplete(result: MotionResult) => void——
    progressProgressSource—Drive from a 0–1 source instead of the own clock.
    reducedMotionReducedMotion——
    sizenumber——
    titlestring—Accessible title: omitted → decorative (aria-hidden); announce success in your own status text.
    triggerProgressTrigger"visible"Default "visible" (once); ignored with progress.

    Also accepts the props of: React DOM attributes.

  • SvgEffectOptions type

    SvgEffectOptions

    SvgEffectOptions
    PropTypeDefaultDescription
    durationnumber—ms (0–10000; default per effect).
    easingEasing | EasingPreset——
    onComplete(result: MotionResult) => void——
    progressProgressSource—Drive from a 0–1 source instead of the own clock.
    reducedMotionReducedMotion——
    triggerProgressTrigger"visible"Default "visible" (once); ignored with progress.
  • SvgTrigger type
    ProgressTrigger
Edit on GitHub