/manim-mobject-svg

Create SVG files from VMobject and VGroup

Primary LanguagePythonMIT LicenseMIT

manim-mobject-svg

Create SVG files from VMobject and VGroup.

Install: pip install manim-mobject-svg

Here's an example of how to use this plugin:

from manim import *
from manim_mobject_svg import *

a = Square(color=BLUE)
a.to_svg("square.svg")

This should create a file square.svg in the current directory and return the path to the file. The output should look like this:

svg square manim

It's also possible to create a SVG file for VGroup.

from manim import *
from manim_mobject_svg import *

a = Square(color=BLUE)
b = Circle(color=RED)
c = VGroup(a, b)
c.to_svg("group.svg")

It'll create a SVG file like this:

svg vgroup manim

Parameters for to_svg()

to_svg() takes the following parameters:

  • path: Path to the SVG file to be created. If not specified, it'll create a temporary file and return the path to the file.
  • crop: Crop the SVG file to the bounding box of the VMobject. Default: True
  • padding: Padding around the VMobject. Default: 0.5

This method returns the path to the SVG file.