A community-maintained Python framework for creating mathematical animations.
Fix 389: document that ShowCreation only works for vectorized mobjects (#730)
Leo Torres88335d49040c
diff --git a/manim/animation/creation.py b/manim/animation/creation.pyindex 4964f85a3..96ad38b20 100644--- a/manim/animation/creation.py+++ b/manim/animation/creation.py@@ -29,18 +29,49 @@ import itertools as itclass ShowPartial(Animation):+ """Abstract class for Animations that show the VMobject partially.++ Raises+ ------+ :class:`TypeError`+ If ``mobject`` is not an instance of :class:`~.VMobject`.++ See Also+ --------+ :class:`ShowCreation`, :class:`~.ShowPassingFlash`+"""- Abstract class for ShowCreation and ShowPassingFlash- """++ def __init__(self, mobject, **kwargs):+ if not isinstance(mobject, VMobject):+ raise TypeError("This Animation only works on vectorized mobjects")+ super().__init__(mobject, **kwargs)def interpolate_submobject(self, submob, start_submob, alpha):submob.pointwise_become_partial(start_submob, *self.get_bounds(alpha))def get_bounds(self, alpha):- raise NotImplementedError()+ raise NotImplementedError("Please use ShowCreation or ShowPassingFlash")class ShowCreation(ShowPartial):+ """Incrementally shows the VMobject.++ Examples+ --------+ .. manim:: ShowCreationScene++ class ShowCreationScene(Scene):+ def construct(self):+ self.play(ShowCreation(Square()))+++ See Also+ --------+ :class:`~.ShowPassingFlash`++ """+CONFIG = {"lag_ratio": 1,}diff --git a/manim/animation/indication.py b/manim/animation/indication.pyindex cb1bcd0e1..b92c45a8e 100644--- a/manim/animation/indication.py+++ b/manim/animation/indication.py@@ -148,6 +148,23 @@ class CircleIndicate(Indicate):class ShowPassingFlash(ShowPartial):+ """Show only a sliver of the VMobject each frame.++ Examples+ --------+ .. manim:: ShowPassingFlashScene++ class ShowPassingFlashScene(Scene):+ def construct(self):+ self.play(ShowPassingFlash(Square()))+++ See Also+ --------+ :class:`~.ShowCreation`++ """+CONFIG = {"time_width": 0.1,"remover": True,