Move
Animation Parameters#
Paremeters - as mentioned in Azarzadvillas Documentation - are:
-
Constructor : -
self.play()
-self.add()
-
Parameters :
-
run_time
: The duration of the animation- float (ex:
3
) - Optional
- Default:
DEFAULT_ANIMATION_RUN_TIME
- float (ex:
Move to Target Parameters#
- Constructor : -
Mobject.generate_target()
-Mobject.target
Apply Method Parameters#
-
method
: The method to apply. It must be the method of a Mobject and must return a Mobject -
*args
: Arguments to be passed to the method -
*kwargs
: Meta-parameters to be passed to the Animation
Move to Target#
from manimlib import *
class AnimationMoveToTarget(Scene):
def construct(self):
square = Square()
square.generate_target()
square.target.shift(2*LEFT)
self.add(square)
self.play(MoveToTarget(square))
from manim import *
class AnimationMoveToTarget(Scene):
def construct(self):
square = Square()
square.generate_target()
square.target.shift(2*LEFT)
self.add(square)
self.play(MoveToTarget(square))
Apply Method#
from manimlib import *
class CustomSquare(Square):
def custom_method(self, color):
self.set_color(color)
self.shift(2 * RIGHT)
return self
class AnimationApplyMethod(Scene):
def construct(self):
square = CustomSquare()
self.add(square)
self.play(ApplyMethod(square.custom_method, YELLOW))
from manim import *
class CustomSquare(Square):
def custom_method(self, color):
self.set_color(color)
self.shift(2 * RIGHT)
return self
class AnimationApplyMethod(Scene):
def construct(self):
square = CustomSquare()
self.add(square)
self.play(ApplyMethod(square.custom_method, YELLOW))