Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Added an Example to :class:`~.DashedVMobject` (#1696)

MathInvarianceaedc85e930c9
diff --git a/manim/mobject/types/vectorized_mobject.py b/manim/mobject/types/vectorized_mobject.py
index d6dae8e0d..28e283d6a 100644
--- a/manim/mobject/types/vectorized_mobject.py
+++ b/manim/mobject/types/vectorized_mobject.py
@@ -2022,6 +2022,41 @@ class CurvesAsSubmobjects(VGroup):
class DashedVMobject(VMobject, metaclass=ConvertToOpenGL):
+ """A :class:`VMobject` composed of dashes instead of lines.
+
+ Examples
+ --------
+ .. manim:: DashedVMobjectExample
+ :save_last_frame:
+
+ class DashedVMobjectExample(Scene):
+ def construct(self):
+ r = 0.5
+
+ top_row = VGroup() # Increasing num_dashes
+ for dashes in range(2, 12):
+ circ = DashedVMobject(Circle(radius=r, color=WHITE), num_dashes=dashes)
+ top_row.add(circ)
+
+ middle_row = VGroup() # Increasing positive_space_ratio
+ for ratio in np.arange(1 / 11, 1, 1 / 11):
+ circ = DashedVMobject(
+ Circle(radius=r, color=WHITE), positive_space_ratio=ratio
+ )
+ middle_row.add(circ)
+
+ sq = DashedVMobject(Square(1.5, color=RED))
+ penta = DashedVMobject(RegularPolygon(5, color=BLUE))
+ bottom_row = VGroup(sq, penta)
+
+ top_row.arrange(buff=0.4)
+ middle_row.arrange()
+ bottom_row.arrange(buff=1)
+ everything = VGroup(top_row, middle_row, bottom_row).arrange(DOWN, buff=1)
+ self.add(everything)
+
+ """
+
def __init__(
self, vmobject, num_dashes=15, positive_space_ratio=0.5, color=WHITE, **kwargs
):