SVGPathMobject

Qualified name: manim.mobject.svg.svg\_path.SVGPathMobject

class SVGPathMobject(path_string, **kwargs)[source]

Bases: manim.mobject.types.vectorized_mobject.VMobject

Methods

generate_points

Generates points from a given an SVG d attribute.

get_original_path_string

A simple getter for the path’s d attribute.

get_path_commands

Returns a list of possible path commands used within an SVG d attribute.

handle_command

Core logic for handling each of the various path commands.

init_points

Generates points from a given an SVG d attribute.

start_new_path

string_to_points

Convert an SVG command string into a sequence of absolute-positioned control points.

Attributes

animate

Used to animate the application of a method.

animation_overrides

depth

The depth of the mobject.

height

The height of the mobject.

width

The width of the mobject.

generate_points()[source]

Generates points from a given an SVG d attribute.

get_original_path_string()[source]

A simple getter for the path’s d attribute.

get_path_commands()[source]

Returns a list of possible path commands used within an SVG d attribute.

See: https://svgwg.org/svg2-draft/paths.html#DProperty for further details on what each path command does.

Returns

The various upper and lower cased path commands.

Return type

List[str]

handle_command(command, coord_string, prev_command)[source]

Core logic for handling each of the various path commands.

init_points()

Generates points from a given an SVG d attribute.

string_to_points(command, is_relative, coord_string, start_point)[source]

Convert an SVG command string into a sequence of absolute-positioned control points.

Parameters
  • command (str) – A string containing a single uppercase letter representing the SVG command.

  • is_relative (bool) – Whether the command is relative to the end of the previous command

  • coord_string (str) – A string that contains many comma- or space-separated numbers that defined the control points. Different commands require different numbers of numbers as arguments.

  • start_point (ndarray) – If the command is relative, the position to begin the relations from.