Core API
The root entry is framework-agnostic and has no React dependency.
prepareSvg
prepareSvg(source, options) reads, validates, sanitizes, namespaces IDs and returns a detached PreparedSvg.
const prepared = await prepareSvg(file, {
trust: "sanitize",
maxBytes: 5 * 1024 * 1024,
signal: abortController.signal,
});
animateSvg
animateSvg(svg, options) is the low-level caller-owned node API. It snapshots all temporary attributes and returns a synchronous controller.
const controller = animateSvg(svg, {
preset: "stagger",
autoplay: false,
stagger: 80,
});
controller.play();
await controller.finished;
mountSvgMotion
mountSvgMotion(container, source, options) combines preparation, mounting and motion. Its instance destroy() also removes the appended SVG.
| Export | Kind | Entry |
|---|---|---|
SvgAnimationError | Class | root |
SvgPreparationError | Class | root |
MountSvgMotionOptions | Interface | root |
PreparedSvg | Interface | root |
PrepareSvgOptions | Interface | root |
SvgDiagnostic | Interface | root |
SvgMotionController | Interface | root |
SvgMotionInstance | Interface | root |
SvgMotionOptions | Interface | root |
SvgAnimationErrorCode | Type alias | root |
SvgDiagnosticCode | Type alias | root |
SvgMotionControllerState | Type alias | root |
SvgMotionOrder | Type alias | root |
SvgMotionPreset | Type alias | root |
SvgPreparationErrorCode | Type alias | root |
SvgSource | Type alias | root |
SvgTrustMode | Type alias | root |
SVG_ANIMATION_ERROR_CODES | Variable | root |
SVG_PREPARATION_ERROR_CODES | Variable | root |
animateSvg | Function | root |
mountSvgMotion | Function | root |
prepareSvg | Function | root |