Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Added FadeOutAndShift animation

Grant Sandersonab90c42ce12c
diff --git a/animation/creation.py b/animation/creation.py
index 7172c0c85..b50d2af01 100644
--- a/animation/creation.py
+++ b/animation/creation.py
@@ -144,9 +144,14 @@ class FadeIn(Transform):
class FadeInAndShiftFromDirection(Transform):
- def __init__(self, mobject, direction=DOWN, **kwargs):
+ CONFIG = {
+ "direction": DOWN,
+ }
+
+ def __init__(self, mobject, direction=None, **kwargs):
digest_config(self, kwargs)
target = mobject.copy()
+ direction = direction or self.direction
mobject.shift(direction)
mobject.fade(1)
Transform.__init__(self, mobject, target, **kwargs)
@@ -161,6 +166,23 @@ class FadeInFromDown(FadeInAndShiftFromDirection):
}
+class FadeOutAndShift(FadeOut):
+ CONFIG = {
+ "direction": DOWN,
+ }
+
+ def __init__(self, mobject, direction=None, **kwargs):
+ FadeOut.__init__(self, mobject, **kwargs)
+ direction = direction or self.direction
+ self.target_mobject.shift(direction)
+
+
+class FadeOutAndShiftDown(FadeOutAndShift):
+ CONFIG = {
+ "direction": DOWN,
+ }
+
+
class VFadeIn(Animation):
"""
VFadeIn and VFadeOut only work for VMobjects, but they can be applied