Anime.js provides powerful tools for animating SVG elements, including path morphing, motion path animations, and line drawing effects.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/juliangarnier/anime/llms.txt
Use this file to discover all available pages before exploring further.
Motion Path
Animate elements along SVG paths usingcreateMotionPath().
Basic Usage
With Offset
Start the animation at a different point along the path:createMotionPath() function returns an object with translateX, translateY, and rotate properties that automatically calculate positions along the path.
The offset parameter ranges from 0 to 1, where 0 is the start of the path and 1 is the end. An offset of 0.25 starts the animation 25% along the path.
Path Morphing
Morph between two SVG paths withmorphTo().
Basic Morphing
Custom Precision
Control the number of points used in the morphing animation:The precision parameter controls how many points are sampled along the paths. Higher values create smoother morphing but may impact performance. Default is 0.33.
Supported Elements
morphTo() works with:
<path>elements<polygon>elements<polyline>elements
Line Drawing
Create drawing and reveal effects withcreateDrawable().
Basic Drawing Effect
Starting State
Set initial draw positions:Advanced Drawing
Combining Techniques
SVG Transform Origin
SVG transforms use a different coordinate system:Performance Tips
Optimize Path Complexity
Optimize Path Complexity
Simplify SVG paths before animating. Complex paths with many points can impact performance.
Use Lower Precision for Morphing
Use Lower Precision for Morphing
If morphing animations feel slow, try lowering the precision parameter:
Reuse Drawable Objects
Reuse Drawable Objects
Create drawable proxies once and reuse them across multiple animations:
Browser Support
All SVG animation features require:- Modern browsers with SVG support
getBoundingClientRect()support for motion pathsgetTotalLength()andgetPointAtLength()for path operations
These features are supported in all modern browsers including Chrome, Firefox, Safari, and Edge.