Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Docs: added Bezier example (#1021)

kolibril139f8bc6880987
diff --git a/manim/mobject/geometry.py b/manim/mobject/geometry.py
index 5659d0614..39492b91d 100644
--- a/manim/mobject/geometry.py
+++ b/manim/mobject/geometry.py
@@ -907,6 +907,28 @@ class DoubleArrow(Arrow):
class CubicBezier(VMobject):
+ """
+ Example
+ -------
+
+ .. manim:: BezierSplineExample
+ :save_last_frame:
+
+ class BezierSplineExample(Scene):
+ def construct(self):
+ p1 = np.array([-3, 1, 0])
+ p1b = p1 + [1, 0, 0]
+ d1 = Dot(point=p1).set_color(BLUE)
+ l1 = Line(p1, p1b)
+ p2 = np.array([3, -1, 0])
+ p2b = p2 - [1, 0, 0]
+ d2 = Dot(point=p2).set_color(RED)
+ l2 = Line(p2, p2b)
+ bezier = CubicBezier([p1b, p1b + 3 * RIGHT, p2b - 3 * RIGHT, p2b])
+ self.add(l1, d1, l2, d2, bezier)
+
+ """
+
def __init__(self, points, **kwargs):
VMobject.__init__(self, **kwargs)
self.set_points(points)