mirror of
https://github.com/3b1b/manim.git
synced 2025-07-30 21:44:19 +08:00
Added FadeOutAndShift animation
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user