Skip to content

Commit 9f8bc68

Browse files
kolibril13behackljsonvillanueva
authored
Docs: added Bezier example (#1021)
Co-authored-by: Benjamin Hackl <[email protected]> Co-authored-by: Jason Villanueva <[email protected]>
1 parent f430af4 commit 9f8bc68

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

manim/mobject/geometry.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,28 @@ def __init__(self, *args, **kwargs):
907907

908908

909909
class CubicBezier(VMobject):
910+
"""
911+
Example
912+
-------
913+
914+
.. manim:: BezierSplineExample
915+
:save_last_frame:
916+
917+
class BezierSplineExample(Scene):
918+
def construct(self):
919+
p1 = np.array([-3, 1, 0])
920+
p1b = p1 + [1, 0, 0]
921+
d1 = Dot(point=p1).set_color(BLUE)
922+
l1 = Line(p1, p1b)
923+
p2 = np.array([3, -1, 0])
924+
p2b = p2 - [1, 0, 0]
925+
d2 = Dot(point=p2).set_color(RED)
926+
l2 = Line(p2, p2b)
927+
bezier = CubicBezier([p1b, p1b + 3 * RIGHT, p2b - 3 * RIGHT, p2b])
928+
self.add(l1, d1, l2, d2, bezier)
929+
930+
"""
931+
910932
def __init__(self, points, **kwargs):
911933
VMobject.__init__(self, **kwargs)
912934
self.set_points(points)

0 commit comments

Comments
 (0)