mirror of
https://github.com/3b1b/manim.git
synced 2025-08-01 17:29:06 +08:00
Added FadeOutAndShift animation
This commit is contained in:
@ -144,9 +144,14 @@ class FadeIn(Transform):
|
|||||||
|
|
||||||
|
|
||||||
class FadeInAndShiftFromDirection(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)
|
digest_config(self, kwargs)
|
||||||
target = mobject.copy()
|
target = mobject.copy()
|
||||||
|
direction = direction or self.direction
|
||||||
mobject.shift(direction)
|
mobject.shift(direction)
|
||||||
mobject.fade(1)
|
mobject.fade(1)
|
||||||
Transform.__init__(self, mobject, target, **kwargs)
|
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):
|
class VFadeIn(Animation):
|
||||||
"""
|
"""
|
||||||
VFadeIn and VFadeOut only work for VMobjects, but they can be applied
|
VFadeIn and VFadeOut only work for VMobjects, but they can be applied
|
||||||
|
Reference in New Issue
Block a user