Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Updated imports in `geometry.py` and added example to :class:`~.Arrow` (#1687)

MathInvariance91f359f264f0
diff --git a/manim/mobject/geometry.py b/manim/mobject/geometry.py
index 878025cbb..3bbb981d4 100644
--- a/manim/mobject/geometry.py
+++ b/manim/mobject/geometry.py
@@ -59,6 +59,10 @@ __all__ = [
"Cutout",
"Angle",
"RightAngle",
+ "ArrowCircleFilledTip",
+ "ArrowCircleTip",
+ "ArrowSquareTip",
+ "ArrowSquareFilledTip",
]
import math
@@ -1264,6 +1268,46 @@ class Arrow(Line):
self.add(Group(g1, g2, g3).arrange(buff=2))
+
+ .. manim:: ArrowExample
+ :save_last_frame:
+
+ class ArrowExample(Scene):
+ def construct(self):
+ left_group = VGroup()
+ # As buff increases, the size of the arrow decreases.
+ for buff in np.arange(0, 2.2, 0.45):
+ left_group += Arrow(buff=buff, start=2 * LEFT, end=2 * RIGHT)
+ # Required to arrange arrows.
+ left_group.arrange(DOWN)
+ left_group.move_to(4 * LEFT)
+
+ middle_group = VGroup()
+ # As max_stroke_width_to_length_ratio gets bigger,
+ # the width of stroke increases.
+ for i in np.arange(0, 5, 0.5):
+ middle_group += Arrow(max_stroke_width_to_length_ratio=i)
+ middle_group.arrange(DOWN)
+
+ UR_group = VGroup()
+ # As max_tip_length_to_length_ratio increases,
+ # the length of the tip increases.
+ for i in np.arange(0, 0.3, 0.1):
+ UR_group += Arrow(max_tip_length_to_length_ratio=i)
+ UR_group.arrange(DOWN)
+ UR_group.move_to(4 * RIGHT + 2 * UP)
+
+ DR_group = VGroup()
+ DR_group += Arrow(start=LEFT, end=RIGHT, color=BLUE, tip_shape=ArrowSquareTip)
+ DR_group += Arrow(start=LEFT, end=RIGHT, color=BLUE, tip_shape=ArrowSquareFilledTip)
+ DR_group += Arrow(start=LEFT, end=RIGHT, color=YELLOW, tip_shape=ArrowCircleTip)
+ DR_group += Arrow(start=LEFT, end=RIGHT, color=YELLOW, tip_shape=ArrowCircleFilledTip)
+ DR_group.arrange(DOWN)
+ DR_group.move_to(4 * RIGHT + 2 * DOWN)
+
+ self.add(left_group, middle_group, UR_group, DR_group)
+
+
See Also
--------
:class:`ArrowTip`