Update¶
UpdateFromFunc¶
-
class
manimlib.animation.update.
UpdateFromFunc
(mobject, update_function, **kwargs)¶ update_function of the form func(mobject), presumably to be used when the state of one mobject is dependent on another simultaneously animated mobject
UpdateFromFuncExample¶
class UpdateFromFuncExample(Scene):
def construct(self):
square = Square().to_edge(UP)
mobject = Text("Text").scale(2).next_to(square, RIGHT)
def update_func(mob):
mob.next_to(square, RIGHT)
self.add(square, mobject)
self.wait()
self.play(
square.to_edge, DOWN,
UpdateFromFunc(mobject, update_func)
)
self.wait()
UpdateFromAlphaFunc¶
-
class
manimlib.animation.update.
UpdateFromAlphaFunc
(mobject, update_function, **kwargs)¶
UpdateFromAlphaFuncExample¶
class UpdateFromAlphaFuncExample(Scene):
def construct(self):
square = Square().to_edge(UP)
mobject = Text("Text").scale(2)
mobject.next_to(square, RIGHT, buff=0.05)
def update_func(mob, alpha):
mob.next_to(square, RIGHT, buff=0.05 + alpha)
self.add(square, mobject)
self.wait()
self.play(
square.to_edge, DOWN,
UpdateFromAlphaFunc(mobject, update_func)
)
self.wait()
MaintainPositionRelativeTo¶
-
class
manimlib.animation.update.
MaintainPositionRelativeTo
(mobject, tracked_mobject, **kwargs)¶
MaintainPositionRelativeToExample¶
class MaintainPositionRelativeToExample(Scene):
def construct(self):
square = Square().to_edge(UP)
mobject = Text("Text").scale(2)
mobject.next_to(square, RIGHT)
self.add(square, mobject)
self.wait()
self.play(
square.to_edge, DOWN,
MaintainPositionRelativeTo(mobject, square)
)
self.wait()