mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Added FadeOutAndShift animation
This commit is contained in:
parent
0f9e1796c7
commit
ab90c42ce1
1 changed files with 23 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue