Reference: Updaters and Trackers

Things that follow other things.

Trackers

The methods add_updater and friends are on Methods. See Updaters for a guide.

  • ValueTracker(value=0): A number you can animate; updaters read it with get_value().
    • .get_value(): Its value (inside an updater, the value on that frame).
    • .set_value(value): Sets it; with .animate, plays the change.
    • .increment_value(d_value): Adds to it; with .animate, plays the change.
from pymations import *

k = ValueTracker(0)
dot = always_redraw(lambda: Dot([k.get_value(), 0, 0], color=YELLOW))
add(dot)
play(k.animate.set_value(4), run_time=2)

Following

  • always_redraw(func): An object made again every frame by a function: always_redraw(lambda: Line(a.get_center(), b.get_center())).
  • always(method, *args): Calls a method every frame: always(label.next_to, dot, UP).
  • f_always(method, *arg_generators): Calls a method every frame with arguments worked out each time: f_always(m.set_x, lambda: t.get_value()).
  • always_shift(mobject, direction=RIGHT, rate=0.1): Moves it steadily in a direction, rate units a second.
  • always_rotate(mobject, rate=20 * DEGREES): Turns it steadily, rate radians a second.
  • TracedPath(traced_point_func, stroke_width=2, stroke_color=WHITE, dissipating_time=None): Draws the path a point leaves behind: TracedPath(dot.get_center).

Time

  • pymations.time(): The animation's time in seconds. Not part of from pymations import *: write import pymations and pymations.time(). Pymations extra (not in Manim).