CurvesAsSubmobjects¶
Qualified name: manim.mobject.types.vectorized\_mobject.CurvesAsSubmobjects
- class CurvesAsSubmobjects(vmobject, **kwargs)[source]¶
Bases:
VGroupConvert a curve’s elements to submobjects.
Examples
Example: LineGradientExample ¶
from manim import * class LineGradientExample(Scene): def construct(self): curve = ParametricFunction(lambda t: [t, np.sin(t), 0], t_range=[-PI, PI, 0.01], stroke_width=10) new_curve = CurvesAsSubmobjects(curve) new_curve.set_color_by_gradient(BLUE, RED) self.add(new_curve.shift(UP), curve)
class LineGradientExample(Scene): def construct(self): curve = ParametricFunction(lambda t: [t, np.sin(t), 0], t_range=[-PI, PI, 0.01], stroke_width=10) new_curve = CurvesAsSubmobjects(curve) new_curve.set_color_by_gradient(BLUE, RED) self.add(new_curve.shift(UP), curve)Methods
Gets the point at a proportion along the path of the
CurvesAsSubmobjects.Attributes
alwaysCall a method on a mobject every frame.
animateUsed to animate the application of any method of
self.animation_overridescolordepthThe depth of the mobject.
fill_colorIf there are multiple colors (for gradient) this returns the first one
heightThe height of the mobject.
n_points_per_curvesheen_factorstroke_colorwidthThe width of the mobject.
- Parameters:
vmobject (VMobject)
- _original__init__(vmobject, **kwargs)¶
Initialize self. See help(type(self)) for accurate signature.
- Parameters:
vmobject (VMobject)
- Return type:
None
- point_from_proportion(alpha)[source]¶
Gets the point at a proportion along the path of the
CurvesAsSubmobjects.- Parameters:
alpha (float) – The proportion along the the path of the
CurvesAsSubmobjects.- Returns:
The point on the
CurvesAsSubmobjects.- Return type:
numpy.ndarray- Raises:
ValueError – If
alphais not between 0 and 1.Exception – If the
CurvesAsSubmobjectshas no submobjects, or no submobject has points.