-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Manim 0.18.1: Updaters don't work with objects which have been added using LaggedStart() #3950
Comments
The problem is caused by the fact that updating is suspended during the class laggingUpdater(Scene):
def construct(self):
vt = ValueTracker(0)
dot1a = Dot().shift(3*UP)
dot2a = Dot().shift(2*UP)
dot3a = always_redraw(lambda:
Dot().shift(1*UP+vt.get_value()*RIGHT)
)
dot1b = Dot().shift(1*DOWN)
dot2b = Dot().shift(2*DOWN)
dot3b = always_redraw(lambda:
Dot().shift(3*DOWN+vt.get_value()*RIGHT)
)
def updater(mobj):
mobj.set_x(vt.get_value())
dot1a.add_updater(updater)
dot1b.add_updater(updater)
self.play(
LaggedStart(
Create(dot1a),
Create(dot2a),
Create(dot3a)
)
)
self.play(
Create(dot1b),
Create(dot2b),
Create(dot3b)
)
dot2a.add_updater(updater)
dot2b.add_updater(updater)
dot1a.resume_updating()
dot2a.resume_updating()
dot3a.resume_updating()
self.wait()
self.play(vt.animate.set_value(7),run_time=4)
self.wait() laggingUpdater.mp4 |
This could be a fix to the issue found in ManimCommunity#3950
A possible fix is to write at def begin(self) -> None:
if not self.animations:
raise ValueError(
f"Trying to play {self} without animations, this is not supported. "
"Please add at least one subanimation."
)
self.anim_group_time = 0.0
if self.suspend_mobject_updating:
self.group.suspend_updating()
for anim in self.animations:
anim.begin()
+ else:
+ for anim in self.animations:
+ anim.finish() I'm actually not sure what's the semantics for |
Oh, I'd better look for this bug first than digging into why my old scenes stoped rendering... Solution was similar to @uwezi: |
Description of bug / unexpected behavior
When adding an object to a scene using
LaggedStart()
no updaters are recognized:.add_updater()
before adding to the scenealways_redraw()
objects.add_updater()
after adding to the sceneExpected behavior
well, updaters should be executed... Especially when added afterwards
How to reproduce the issue
Code for reproducing the problem
Additional media files
Rendered video
laggingUpdater.mp4
System specifications
System Details
PASTE HERE
The text was updated successfully, but these errors were encountered: