Noureddine RAMDI / Sketch2Motion: animating static images by vectorizing and animating SVG paths with Manim

Created Mon, 06 Jul 2026 15:15:52 +0000 Modified Mon, 06 Jul 2026 15:16:10 +0000

leeyeel/Sketch2Motion

Sketch2Motion turns static images or sketches into animated videos by vectorizing them into SVG format and rendering the drawing process with Manim. The project is an interesting example of combining image vectorization, procedural animation, and a lightweight web UI for live parameter tweaking.

how Sketch2Motion converts static images into animated videos

At its core, Sketch2Motion accepts static raster inputs—photos or sketches—and vectorizes them into SVG paths. This step is crucial because it converts pixel data into scalable vector paths that can be animated individually. The vectorization pipeline isn’t described in full detail, but it relies on standard image-to-SVG conversion techniques.

Once vectorized, the project uses Manim, a Python animation library typically used for math visualizations, to render these SVG paths dynamically. Manim’s core strength is programmatic animation of geometric objects, and here it is adapted to animate the drawing of each SVG subpath sequentially.

The animation pipeline supports four drawing styles:

  • linear: draws each path straightforwardly in sequence.
  • smooth: introduces gradual transitions between subpaths for fluidity.
  • there_and_back: animates forward along the path, then reverses back.
  • wiggle: adds a playful wobble effect to the drawing.

Each style is parameterized by three parameters: animation duration, subpath delay ratio, and scale factor. This lets you adjust the speed, pacing, and size of the animated strokes. The last frame of the animation is prepended as a pause to create a polished intro effect.

The entire pipeline is wrapped in a Gradio web interface that handles image upload, SVG preview, style selection, and triggers video generation. The output is an MP4 video file encoded with ffmpeg, which must be installed and available in the system PATH.

technical strengths in animation parameterization and pipeline design

What sets Sketch2Motion apart is how it leverages the order and timing of drawing SVG subpaths to produce different animation styles without changing the underlying vector data. The core idea is subpath-based traversal: the animation engine iterates through each SVG subpath and animates it with specific timing and style parameters to produce distinct visual effects.

This approach is elegant because it separates vector data from animation logic. The same SVG can yield multiple animation styles simply by adjusting parameters on traversal order, delays, and scaling. This avoids having to regenerate or manipulate the vector graphic for each style.

Manim’s use is pragmatic. While it’s primarily designed for mathematical animations, it’s flexible enough to animate arbitrary SVG paths with precise control over timing and easing. The code quality appears clean and modular, with a clear separation between the vectorization step, animation logic, and the Gradio frontend.

A tradeoff here is performance and complexity. Manim is not optimized for real-time rendering or heavy SVG scenes, so the project targets relatively simple sketches or photos that produce manageable SVG complexity. Also, the dependency on ffmpeg means the video encoding step is external, which adds some operational overhead but is a solid choice for compatibility.

The Gradio UI is minimal but effective, providing an accessible DX for experimenting with different animation styles and parameters without requiring manual scripting or command-line usage.

quick start with Sketch2Motion

Clone the repo and install dependencies:

git clone https://github.com/leeyeel/Sketch2Motion.git
cd Sketch2Motion
pip install -r requirements.txt

Dependencies include:

  • Python 3.9 or newer
  • Manim for animation rendering
  • Gradio for the web interface
  • ffmpeg must be installed and in your system PATH for video encoding

To install ffmpeg:

  • Windows: Download from the official site and add the bin folder to your PATH
  • macOS: brew install ffmpeg
  • Linux: Use your package manager, e.g., sudo apt install ffmpeg

After setup, you can run the Gradio app script to open the web UI, upload images, tweak parameters, and generate animated MP4 videos.

verdict: who should use Sketch2Motion

Sketch2Motion is a neat tool if you want to visualize the drawing process of static images or sketches with simple animated styles. Its use of SVG vectorization combined with parameterized subpath animation gives it flexibility for creating varied effects from the same input.

The project is well suited for hobbyists, educators, or anyone looking to generate simple animated videos of drawings without delving into manual animation software. It’s not designed for high-performance production animation or complex vector art due to Manim’s rendering constraints.

The codebase is clean and approachable if you want to extend it or experiment with new animation styles. The Gradio frontend provides a low barrier to entry for trying it out.

Limitations include the dependency on external tools (ffmpeg), the performance bottleneck for very complex SVGs, and the reliance on Manim which is not inherently an animation studio-grade tool. But within these constraints, it solves a real problem with a straightforward, modular pipeline.

If you work with educational content, demos, or simple drawing animations, Sketch2Motion is worth exploring. The repo is at https://github.com/leeyeel/Sketch2Motion and comes with installation instructions and code to get started quickly.


→ GitHub Repo: leeyeel/Sketch2Motion ⭐ 72 · Python