Skip to content

Transform

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

Transform#

from manimlib import *

class AnimationTransform(Scene):
    def construct(self):

        square = Square()
        circle = Circle()
        self.add(square)
        self.play(Transform(square, circle))
        square.generate_target()
        square.target.move_to(2*UP)
        self.play(MoveToTarget(square))
from manim import *

class AnimationTransform(Scene):
    def construct(self):

        square = Square()
        circle = Circle()
        self.add(square)
        self.play(Transform(square, circle))
        square.generate_target()
        square.target.move_to(2*UP)
        self.play(MoveToTarget(square))

Replacement Transform#

from manimlib import *

class AnimationReplacementTransform(Scene):
    def construct(self):

        square = Square()
        circle = Circle()
        self.add(square)
        self.play(ReplacementTransform(square, circle))
        circle.generate_target()
        circle.target.move_to(2*UP)
        self.play(MoveToTarget(circle))
from manim import *

class AnimationReplacementTransform(Scene):
    def construct(self):

        square = Square()
        circle = Circle()
        self.add(square)
        self.play(ReplacementTransform(square, circle))
        circle.generate_target()
        circle.target.move_to(2 * UP)
        self.play(MoveToTarget(circle))

Transform from Copy#

from manimlib import *

class AnimationTransformFromCopy(Scene):
    def construct(self):

        square = Square()
        circle = Circle()
        self.add(square)
        self.play(TransformFromCopy(square, circle))
        self.remove(circle)
        self.wait(2)
from manim import *

class AnimationTransformFromCopy(Scene):
    def construct(self):

        square = Square()
        circle = Circle()
        self.add(square)
        self.play(TransformFromCopy(square, circle))
        self.remove(circle)
        self.wait(2)
Back to top