A community-maintained Python framework for creating mathematical animations.
Added VFadeIn and VFadeOut
Grant Sandersonbf1fbaba7ab9
diff --git a/animation/creation.py b/animation/creation.pyindex 0b32ac75b..7172c0c85 100644--- a/animation/creation.py+++ b/animation/creation.py@@ -160,6 +160,33 @@ class FadeInFromDown(FadeInAndShiftFromDirection):"direction": DOWN,}++class VFadeIn(Animation):+ """+ VFadeIn and VFadeOut only work for VMobjects, but they can be applied+ to mobjects while they are being animated in some other way (e.g. shifting+ then) in a way that does not work with FadeIn and FadeOut+ """+ def update_submobject(self, submobject, starting_submobject, alpha):+ submobject.set_stroke(+ width=interpolate(0, starting_submobject.get_stroke_width(), alpha)+ )+ submobject.set_fill(+ opacity=interpolate(0, starting_submobject.get_fill_opacity(), alpha)+ )+++class VFadeOut(VFadeIn):+ CONFIG = {+ "remover": True+ }++ def update_submobject(self, submobject, starting_submobject, alpha):+ VFadeIn.update_submobject(+ self, submobject, starting_submobject, 1 - alpha+ )++# Growing