FadeTransform#
Qualified name: manim.animation.transform.FadeTransform
- class FadeTransform(mobject=None, *args, use_override=True, **kwargs)[source]#
Bases:
Transform
Fades one mobject into another.
- Parameters
mobject – The starting
Mobject
.target_mobject – The target
Mobject
.stretch – Controls whether the target
Mobject
is stretched during the animation. Default:True
.dim_to_match – If the target mobject is not stretched automatically, this allows to adjust the initial scale of the target
Mobject
while it is shifted in. Setting this to 0, 1, and 2, respectively, matches the length of the target with the length of the startingMobject
in x, y, and z direction, respectively.kwargs – Further keyword arguments are passed to the parent class.
Examples
Example: DifferentFadeTransforms ¶
from manim import * class DifferentFadeTransforms(Scene): def construct(self): starts = [Rectangle(width=4, height=1) for _ in range(3)] VGroup(*starts).arrange(DOWN, buff=1).shift(3*LEFT) targets = [Circle(fill_opacity=1).scale(0.25) for _ in range(3)] VGroup(*targets).arrange(DOWN, buff=1).shift(3*RIGHT) self.play(*[FadeIn(s) for s in starts]) self.play( FadeTransform(starts[0], targets[0], stretch=True), FadeTransform(starts[1], targets[1], stretch=False, dim_to_match=0), FadeTransform(starts[2], targets[2], stretch=False, dim_to_match=1) ) self.play(*[FadeOut(mobj) for mobj in self.mobjects])
Methods
Initial setup for the animation.
Clean up the
Scene
after finishing the animation.get_all_families_zipped
Get all mobjects involved in the animation.
Replaces the source by the target and sets the opacity to 0.
Attributes
path_arc
path_func
- begin()[source]#
Initial setup for the animation.
The mobject to which this animation is bound is a group consisting of both the starting and the ending mobject. At the start, the ending mobject replaces the starting mobject (and is completely faded). In the end, it is set to be the other way around.
- clean_up_from_scene(scene)[source]#
Clean up the
Scene
after finishing the animation.This includes to
remove()
the Animation’sMobject
if the animation is a remover.- Parameters
scene – The scene the animation should be cleaned up from.