Animation And Timeline
Use the scene timeline deliberately: direct animations with play(), property-driven motion with animate, object replacement with transforms, and reactive motion with trackers and updaters.
play() And animate
play() runs an animation. The animate interface is the concise way to turn object method chains into timeline motion.
square = Square().set_fill(RED, opacity=1.0)self.add(square)self.play(square.animate.set_fill(WHITE), run_time=1)self.play(square.animate.shift(UP).rotate(PI / 3), run_time=1.5) Transforms
Transformmorphs one object into another while continuing to animate the source variable.ReplacementTransformis the right tool when the target object should take over afterward.TransformFromCopyis useful when the original object should remain visible.
Indication Animations
Use indication effects such as Indicate, Circumscribe, Flash, andApplyWave when you want emphasis without changing the underlying scene structure.
Trackers And Updaters
ValueTracker and always_redraw() are the core tools for reactive scenes, animated counters, graphs, and parameterized motion systems.
tracker = ValueTracker(0) dot = always_redraw( lambda: Dot(color=YELLOW).move_to(RIGHT * tracker.get_value())) self.add(dot)self.play(tracker.animate.set_value(3), run_time=1.5)