User
Vivus is a JavaScript animation library. It animates paths like doodles. But it hasn’t been updated in 3 years.
List all popular, modern, lightweight JavaScript alternatives that animate existing SVG paths (creating a doodle-like or an animated drawing effect).
Gemini
Thinking: Seeking SVG Animation Tools
I’m currently investigating lightweight and modern JavaScript libraries akin to Vivus for SVG path animation. My focus is on tools with recent updates and strong community support, so I’m comparing alternatives such as Anime.js, Motion One, and GSAP based on their last update, popularity metrics (stars and downloads), and file size.
Thinking: Evaluating Animation Libraries
I’ve begun evaluating alternative JavaScript SVG path animation libraries, focusing on lightweight options. Anime.js has surfaced as a strong contender. Its performance claims are intriguing, and I’m eager to delve into its feature set and ease of implementation. Next, I’ll be looking into the specifics of its animation capabilities.
Scrutinizing Library Versions
I’m now digging into Vivus and its claimed lightweight status. While it was once small, I’m verifying the latest version and comparing its features against Anime.js and GSAP. My initial searches unearthed potential version inconsistencies for Vivus, so I need to clear that up. I am also investigating whether GSAP’s DrawSVGPlugin is truly accessible for free now. The snippets are leading me to Reddit where I can hopefully find a definitive answer about whether or not that plugin is included in the free version.
Analyzing New Alternatives
I’ve discovered two new contenders: Motion One and Lazy Line Painter. Motion One, built on the Web Animations API, looks promising for its modern approach. Lazy Line Painter is explicitly for SVG paths, but I’m investigating its maintenance status due to conflicting information regarding recent updates. Vivus’ popularity is evident with over 4500 weekly NPM downloads and 13.5K GitHub stars. I’m focusing on clarifying Lazy Line Painter’s current state and licensing.
Thinking: Analyzing Options Further
I’ve learned that GSAP is now completely free, even for commercial use, including DrawSVGPlugin. This is a game-changer and positions it strongly as a viable solution. While it still might not be as lightweight as Vivus, this is a significant development to consider.
Examining Alternatives Now
I’m now diving into the alternatives, specifically Motion One and KUTE.js. Motion One’s WAAPI-based approach is intriguing, offering a modern, lightweight option. I need to verify KUTE.js’s SVG plugin features. I also need to quickly check the status of Walkway.js, as well as confirm whether Vivus or Anime.js remain viable. My goal is to narrow down the options for line drawing.
Finalizing the Recommendation
I’ve determined that Motion One is the champion for modern lightweight SVG animation. It utilizes the Web Animations API, making it incredibly appealing. While GSAP offers immense power and a free DrawSVG plugin, its size makes it less ideal for pure lightweight applications. Anime.js remains a solid alternative, and KUTE.js is not an option. Vivus is no longer the top dog.
The following libraries are the best modern, lightweight alternatives to Vivus for animating SVG paths (creating “doodle” or “drawing” effects).
Top Recommendation: Motion One
This is the most “modern” successor. It is built on the native Web Animations API (WAAPI), making it incredibly lightweight and performant because the browser does the heavy lifting.
- Why it’s a great alternative: It has a dedicated
drawfeature for SVG paths that works exactly like Vivus but uses modern browser tech. - Size: Extremely lightweight (~3.8kb gzipped).
- Status: Active, modern (maintained by the creator of Framer Motion).
- Usage:
import { animate } from "motion"
animate("path", { pathLength: [0, 1] }, { duration: 2 })
Best All-Rounder: Anime.js
Anime.js is one of the most popular animation libraries. It is lightweight and has a specific system for SVG line drawing that is as simple as Vivus.
- Why it’s a great alternative: It is widely used, stable, and handles the “line drawing” effect effortlessly with its
strokeDashoffsetanimation properties. - Size: Lightweight (~6kb gzipped).
- Status: Very Popular / Stable.
- Usage:
anime({
targets: 'path',
strokeDashoffset: [anime.setDashoffset, 0],
easing: 'easeInOutSine',
duration: 1500
});
The Powerhouse (Now Free): GSAP with DrawSVGPlugin
GSAP (GreenSock) is the industry standard for web animation. Previously, its DrawSVGPlugin was a paid feature, but as of 2024/2025, GSAP and its plugins are free for most standard use cases.
- Why it’s a great alternative: It is far more robust than Vivus. If you need to sequence the drawing with other complex animations, this is the best choice.
- Size: Heavier (~23kb core + plugin). It is not “lightweight” in the same sense as Vivus, but it is highly performant.
- Status: Actively maintained (The “Gold Standard”).
- Usage:
gsap.from("path", { drawSVG: 0, duration: 2 });
Other Notable Mentions
- Lazy Line Painter:
- Best for: Specifically converting SVG artwork into animated line drawings. It comes with a GUI “Composer” tool to help prepare your SVGs, which Vivus users often find helpful.
- Status: Mature (updates are less frequent, but it works well for this specific niche).
- KUTE.js:
- Best for: If you need to morph shapes while drawing them. It has a dedicated SVG plugin that is very powerful for complex path manipulations.
- Focus: Performance and memory efficiency.
Summary Comparison Table
LibraryBest ForWeight (Gzipped)Modern TechMotion One**Performance & Size (Native WAAPI)~3.8kb✅ YesAnime.js**Ease of Use & General Animation6kb❌ JS-based**GSAP**Complex Sequences & Reliability25kb+❌ JS-basedVivus(The original reference)~4kb❌ LegacyExport to SheetsMy advice: If you want a 1-to-1 lightweight replacement, go with Motion One. If you want a library that can animate your whole website (not just paths), go with **Anime.js**.
User
Animate an SVG with GSAP + DrawSVG, Anime.js, Motion, and Lazy Line Painter as a single-page HTML file - no React, just vanilla JS. Make sure it works. Then, suggest which option you would recommend.
Gemini
Thinking: Crafting SVG Animations
I’m currently focused on the framework. I’m prioritizing GSAP, Anime.js, Motion One, and Lazy Line Painter. I need to include CDNs for these four libraries. I will need to ensure vanilla JS only, as specified.
Analyzing Library Features
I’ve been examining the different animation libraries. I’m leaning toward creating a visual comparison using identical SVGs, each animated with a different approach. My current plan involves GSAP with DrawSVG (with a crucial check on its free status), Anime.js, Motion One, and Lazy Line Painter. I need to make sure I include CDNs for each library. I’ll finalize by making a recommendation.
Refining SVG Implementation
I’m now zeroing in on the SVG animation methods. The good news is, DrawSVG seems to be now, finally, free with GSAP (subject to confirmation on availability). I’ve got to investigate the CDN availability and consider the fallback of simulating
strokeDashoffsetif needed. I can now proceed with vanilla JS methods, which helps the flow.Finalizing GSAP Approach
My current focus is locking in the GSAP strategy. Although I had hoped for a simple DrawSVG plugin implementation, I’m now certain I’ll use the reliable
strokeDashoffsetapproach. This guarantees it’s free and readily available for the user. I’ll clearly label it as such. I’m no longer considering the potentially unavailable trial link.Pinpointing CDN Options
I’m now fully immersed in the CDN setup. For GSAP, I’ll showcase its capability using the CodePen trial URL for DrawSVG. My fallback plan is commented code for simulating
strokeDashoffset, if necessary. For Anime.js, I’ve got the CDN ready. Motion One will be imported as a module. And finally, I’ve confirmed Lazy Line Painter’s stable CDN. I will finalize with implementation!Defining the SVG Layout
I’m now designing the SVG structure. I’ll animate a simple “Hello” text and a heart icon to showcase the drawing effects. I plan to present these animations within four distinct cards, each triggered independently.
I’m structuring the HTML with a basic HTML5 boilerplate and Tailwind CSS for styling. I’ll import the necessary libraries. I’ve chosen to use the CDN for Motion One, and it is a ES module import. Lazy Line Painter is now working as intended, and I’ll initialize it using
new LazyLinePainter(). The GSAP implementation will use thestrokeDashoffsetanimation method for reliability.Reconsidering the Approach
I’m now revisiting the GSAP strategy. Initially, I was going to use the trial plugin, but after searching, I found the DrawSVG link is not working as expected. So, I will implement it by using the reliable
strokeDashoffsetapproach. This ensures it’s readily available to all users. I will clearly label it as such in the source code.
Thinking: Designing the SVG Demo
I’m currently fleshing out the structure of
index.html. My focus is now on how to integrate the four animation libraries without framework dependencies. I’m prioritizing clarity in the code, ensuring each library has its dedicated section for easy comparison. The goal is to provide a solid, no-frills example of path animation, showcasing each library’s unique approach.Finalizing Library Implementations
I’ve decided to use the vanilla GSAP
strokeDashoffsettechnique, labeling it as “GSAP (Vanilla / Free)” for robustness. My focus is now on ensuring the code is fully self-contained and runnable, with each library neatly sectioned for straightforward comparison. The next step involves solidifying the JS logic to bring the SVG path to life using all four methods.Adding Specific Library Links
I’ve incorporated the specified links for the libraries. Using the CodePen trial link for DrawSVG is a strategic choice for demonstration. I’m focusing on organizing the HTML structure, with a 2x2 grid layout ready to house the SVG paths. The priority is to clearly separate each library’s code. I’m also ensuring the SVG path is identical in all four containers for straightforward comparison.
Updating Animation Implementations
I’m now fully committed to the “free” implementation of GSAP, utilizing
strokeDashoffsetfor path animation to ensure broad compatibility. For the other libraries (Anime, Motion, Lazy Line Painter), the code is straightforward. I’m prioritizing clear, concise syntax. My immediate task is integrating these code snippets into the HTML layout. The goal is a working, ready-to-run demo focusing on path animation.Solidifying the Alternatives
I’ve decided to stick with the vanilla GSAP method, labeling it “GSAP (Native / Free)” for maximum reliability and accessibility, which provides a modern alternative. I’m importing Motion One and ensuring Lazy Line Painter correctly recognizes the existing SVG paths, confirming it works on existing paths using
new LazyLinePainter(el, config). I’ll include a recommendation after presenting the code.Constructing the Demo File
I’m now integrating the libraries and styles into
index.html. I’ve decided to use the standardstrokeDashoffsetfor GSAP (“GSAP (Core)”) for reliability. I’m also setting up the four SVG instances and arranging the CDN links for Tailwind, Anime.js, Lazy Line Painter, and GSAP. My focus is creating a clear, functional layout. I will keep it simple.
Here is a complete, single-file HTML solution. It uses Tailwind CSS for layout and includes all four libraries via CDN.
I have set up a 2x2 grid where identical SVGs are animated by each library simultaneously so you can compare the syntax and performance directly.
Note on GSAP: I have included the “Trial” version of the DrawSVG plugin (often used for testing). If you use GSAP commercially or on a live domain, you would typically need the paid club membership or use the vanilla strokeDashoffset method (which I have also included as a fallback comment in the code).SVG Animation Comparison16 Dec, 17:30
Which one should you choose?
- For 90% of modern projects: Choose Motion
- Why: It is the smallest and most performant. It uses the browser’s native Web Animations API (WAAPI) but gives you a simple syntax
pathLength: [0, 1]. - Code:
animate("path", { pathLength: [0, 1] }) - Weight: < 5kb.
- Why: It is the smallest and most performant. It uses the browser’s native Web Animations API (WAAPI) but gives you a simple syntax
- For complex animation sequences: Choose GSAP
- Why: If the line drawing is just one part of a huge animation (e.g., the line draws, then the logo scales up, then text flies in), GSAP’s
Timelineis unbeatable. - Note: You don’t actually need the paid
DrawSVGplugin. As seen in the code fallback I wrote, you can achieve the exact same effect with the free GSAP core by animatingstrokeDashoffset.
- Why: If the line drawing is just one part of a huge animation (e.g., the line draws, then the logo scales up, then text flies in), GSAP’s
- For ease of use (The “Vivus” feel): Choose Anime.js
- Why: It feels the most like a direct successor to Vivus in spirit. The
anime.setDashoffsethelper function is very convenient and requires zero math from you.
- Why: It feels the most like a direct successor to Vivus in spirit. The
User
Animate this SVG using all four libraries. Ensure that it is animated path by path, one after another, like a hand drawn SVG. Ensure that the total time is about 30 seconds.
Gemini
Thinking: Evaluating Animation Options
I’ve been exploring the best approach to animate this SVG. Considering the user’s requirements – a 30-second, hand-drawn-style effect – I’m leaning toward Lazy Line Painter for its dedicated path-drawing capabilities. However, I’m also comparing it to Motion One, Anime.js, and GSAP to ensure optimal performance and flexibility, especially for managing the sequence of path animations.
Diving into SVG Structure
I’m now fully immersed in the SVG’s details. I’ve parsed the code and noted its hierarchical structure. It’s time to modify the
index.htmlfile to incorporate this new, complex SVG, and then update CSS and layout to handle its dimensions. The next step is writing JavaScript for sequential path animation, considering the interplay between strokes and fills. Specifically, I’m thinking about setting fill attributes to transparent at the start of the animation to get the line drawing effect.Calculating Animation Timing
I’ve been working on getting the timing of the animation right. The user mentioned an animation time of about 30 seconds for many paths. I’ve estimated around 100 paths in the SVG. So, I calculated each path could take about 0.3 seconds. I’m focusing on two libraries now. Motion One seems good for a timeline, which I’ll build. Anime.js’s delay property looks helpful, and I’ll see if it suits the project.
Evaluating Animation Libraries Further
I’m now fully immersed in the nuances of animation libraries. GSAP, with its powerful timeline control, is quite appealing. The
staggerfeature is easy, so I’m investigating how to precisely control the duration. I’m also consideringstagger: each_durationfor strict sequencing. Lazy Line Painter, built for this specific purpose, offers a natural sequential drawing behavior, though I must carefully configuredrawSequentialand timing adjustments to fit the 30-second timeline.Organizing SVG Elements
I’m structuring the code to avoid any animation conflicts between the four examples. I’ll use unique container IDs -
#motion-container,#anime-container, etc. - to isolate the path selections. Specifically, I’ll usedocument.querySelectorAll('#motion-container path')or similar selectors. Also, I’m thinking about the fills, and how to create the “doodle” effect.Adapting Stroke Properties
I’m now fully immersed in the SVG’s details. I’ve realized that the supplied file has an inconsistency: certain paths use fill to define shapes. To achieve the hand-drawn effect, I’ll universally apply
stroke: #000; stroke-width: 1px; fill: none;to all paths in the CSS. This guarantees a uniform look and makes the dash-offset animation possible. This is a critical adjustment to achieve the desired effect; I’ll preserve the original logic as much as possible, though.Reconciling Visual Styles
I’ve been thinking about the visual intent, and have considered the user’s initial preference for a “hand-drawn” look, which implies a line-based aesthetic. Now I will handle the file with the inconsistencies and adapt the strokes. I will preserve the original colors of the strokes if present. For the animation, I’ll apply
stroke: currentColor;to each path, in the CSS, if no stroke is already specified. Where there are fill-only paths, I’ll addstroke: currentColor; fill: none;.// Example in GSAP gsap.set("#gsap-svg path", { stroke: function(target) { return getComputedStyle(target).stroke || target.getAttribute("stroke") || "currentColor"; }, fill: "none" });Here’s the planned code structure:
#gsap-container path { /* Set a default stroke color */ stroke: currentColor; fill: none; stroke-width: 1; /* optional, set a default width or use attribute for more control */ }Optimizing Animation Sequences
I’m now fully immersed in the nitty-gritty of the SVG animation. I’ve been experimenting with GSAP’s
drawSVGproperty, focusing on duration and staggering for sequential path animations. While Lazy Line Painter simplifies path length analysis, achieving precise 30-second timing with its auto-calculation is proving challenging. I am now leaning toward a GSAP solution. Additionally, I’ve standardized the path appearance with CSS, ensuring all paths have a stroke, enabling the drawing effect across the SVG’s design. I’m focusing on finding the idealstaggervalue for GSAP to get each path to draw within the allotted time.Refining SVG Insertion
I’m now fully immersed in the SVG insertion method. After evaluating alternatives, I’m confident that cloning the SVG structure via JavaScript is the optimal approach for this project. This approach minimizes file size issues and allows for easier animation control. The key update involves structuring the HTML to hide the original, single SVG and using JavaScript to create unique, animatable instances for each example. I’m now testing the cloning process to confirm its integration.
I will generate the updated index.html file.
Key Changes:
- SVG Handling: The provided SVG is complex and contains filled shapes without strokes. To create the requested “hand-drawn doodle” effect, I have added CSS to force all paths to have a stroke and no fill (
fill: none !important; stroke: white;). - Duplication: I’ve embedded the SVG once in a
<template>tag and used JavaScript to clone it into the four comparison containers. This keeps the code clean. - Timing Logic: I calculated the number of paths dynamically to ensure the total animation time is approximately 30 seconds for each library, regardless of the path count (which is high in this SVG).
- Sequential Animation:
- Motion One: Uses
timelineto sequence the paths. - Anime.js: Uses
delay: anime.stagger(duration)to strictly sequence them. - GSAP: Uses
staggerequal to the duration to prevent overlap. - Lazy Line Painter: Uses
drawSequential: true. (Note: LLP calculates duration based on path length, so I adjusted thespeedMultiplierto approximate the 30s feel, though exact duration control is harder with this library).
- Motion One: Uses