MCPcopy
hub / github.com/ManimCommunity/manim / FadeIn

Class FadeIn

manim/animation/fading.py:98–143  ·  view source on GitHub ↗

r"""Fade in :class:`~.Mobject` s. Parameters ---------- mobjects The mobjects to be faded in. shift The vector by which the mobject shifts while being faded in. target_position The position from which the mobject starts while being faded in. In case

Source from the content-addressed store, hash-verified

96
97
98class FadeIn(_Fade):
99 r"""Fade in :class:`~.Mobject` s.
100
101 Parameters
102 ----------
103 mobjects
104 The mobjects to be faded in.
105 shift
106 The vector by which the mobject shifts while being faded in.
107 target_position
108 The position from which the mobject starts while being faded in. In case
109 another mobject is given as target position, its center is used.
110 scale
111 The factor by which the mobject is scaled initially before being rescaling to
112 its original size while being faded in.
113
114 Examples
115 --------
116
117 .. manim :: FadeInExample
118
119 class FadeInExample(Scene):
120 def construct(self):
121 dot = Dot(UP * 2 + LEFT)
122 self.add(dot)
123 tex = Tex(
124 "FadeIn with ", "shift ", r" or target\_position", " and scale"
125 ).scale(1)
126 animations = [
127 FadeIn(tex[0]),
128 FadeIn(tex[1], shift=DOWN),
129 FadeIn(tex[2], target_position=dot),
130 FadeIn(tex[3], scale=1.5),
131 ]
132 self.play(AnimationGroup(*animations, lag_ratio=0.5))
133
134 """
135
136 def __init__(self, *mobjects: Mobject, **kwargs: Any) -> None:
137 super().__init__(*mobjects, introducer=True, **kwargs)
138
139 def create_target(self) -> Mobject:
140 return self.mobject # type: ignore[return-value]
141
142 def create_starting_mobject(self) -> Mobject:
143 return self._create_faded_mobject(fadeIn=True)
144
145
146class FadeOut(_Fade):

Calls

no outgoing calls