manim.mobject.functions.ParametricFunction

class ParametricFunction(function=None, t_range=None, dt=1e-08, discontinuities=None, use_smoothing=True, **kwargs)[source]

Bases: manim.mobject.types.vectorized_mobject.VMobject

A parametric curve.

Examples

Example: PlotParametricFunction

../_images/PlotParametricFunction-1.png
from manim import *

class PlotParametricFunction(Scene):
    def func(self, t):
        return np.array((np.sin(2 * t), np.sin(3 * t), 0))

    def construct(self):
        func = ParametricFunction(self.func, t_max = TAU, fill_opacity=0).set_color(RED)
        self.add(func.scale(3))

Example: ThreeDParametricSpring

../_images/ThreeDParametricSpring-1.png
from manim import *

class ThreeDParametricSpring(ThreeDScene):
    def construct(self):
        curve1 = ParametricFunction(
            lambda u: np.array([
                1.2 * np.cos(u),
                1.2 * np.sin(u),
                u * 0.05
            ]), color=RED, t_min=-3 * TAU, t_max=5 * TAU,
        ).set_shade_in_3d(True)
        axes = ThreeDAxes()
        self.add(axes, curve1)
        self.set_camera_orientation(phi=80 * DEGREES, theta=-60 * DEGREES)
        self.wait()

Methods

generate_points

Initializes points and therefore the shape.

get_function

get_point_from_function

Attributes

animate

Used to animate the application of a method.

depth

The depth of the mobject.

height

The height of the mobject.

width

The width of the mobject.

generate_points()[source]

Initializes points and therefore the shape.

Gets called upon creation. This is an empty method that can be implemented by subclasses.