Draws the strokes of an SVG as if by hand — a stroke-dashoffset animation applied to every path, line, circle, polyline, polygon, ellipse and rect inside the element (or to the element itself, if you put the class directly on an SVG shape).
Classes
| Class | Plays |
|---|---|
fx-draw-svg-pl | On page load |
fx-draw-svg-st | When the element scrolls into view |
fx-draw-svg | Automatically, when its section scrolls into view |
fx-draw-svg-scrub | Tied directly to scroll position instead of playing once |
Options that matter
- Duration —
fx-duration-[n], default2seconds (ignored in scrub mode). - Delay —
fx-delay-[n], default0. - Ease —
fx-ease-[name], defaultpower2.inOut. - Start position —
fx-start-[pos], defaulttop 85%(scroll-triggered only). - Scrub —
fx-scrub-[n], e.g.fx-scrub-[0.6]. Adding this modifier switches the effect into scrub mode the same wayfx-draw-svg-scrubdoes, and sets the smoothing amount (higher = smoother lag behind the scrollbar).
Example
<div class="fx-draw-svg-st">
<svg viewBox="0 0 100 100"><path d="M10 90 L50 10 L90 90" /></svg>
</div>
Only elements with a real stroke are drawn — make sure your SVG shapes have stroke set (not just fill).