manim icon indicating copy to clipboard operation
manim copied to clipboard

Implement :attr:`.Mobject.always`, and move builders to their own file

Open JasonGrace2282 opened this issue 1 year ago • 3 comments

Motivation

Allows for syntax like

d = Dot()
s = Square()
d.always.next_to(s, UP)
self.add(s, d)
self.play(s.animate.to_edge(LEFT))

Changelog

  • Implemented _UpdaterBuilder
  • Moved _AnimationBuilder and _UpdaterBuilder to their own file.
  • Made _AnimationBuilder generic in it's mobject, to match experimental

Note

I opted to allow imports of _UpdaterBuilder/_AnimationBuilder from Mobject itself, even though they're in their own file (manim.mobject.builders).

[!WARNING] .always is a thin wrapper around add_updater, as such the usual caveats apply. If two updaters are added that affect the position, weird things could happen.

Documentation

https://manimce--3852.org.readthedocs.build/en/3852/reference/manim.mobject.mobject.Mobject.html#manim.mobject.mobject.Mobject.always

JasonGrace2282 avatar Jul 12 '24 14:07 JasonGrace2282

This is actually very interesting, huge +1 for the API; I like it a lot!

Will review in-depth over the weekend, but I strongly believe we should ship this with the next release. 🚀

behackl avatar Jul 12 '24 17:07 behackl

Currently incomptaible with ValueTracker, on hold until ValueTracker is lazy!

MrDiver avatar Jul 21 '24 14:07 MrDiver

I think it might be better just to get it merged in its current state. Valuetrackers can be added in a later PR, but I would love to have this in 0.19.0

JasonGrace2282 avatar Oct 22 '24 15:10 JasonGrace2282