-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Open
Labels
help wantedWe would appreciate help on this issue/PRWe would appreciate help on this issue/PRissue:bugSomething isn't working... For use in issuesSomething isn't working... For use in issues
Description
Description of bug / unexpected behavior
Animations behave differently depending on the way the mobject was added to the scene. If I use self.play(Create(mobj))
there is no lag, if I use self.add(mobj)
the animation lags in certain cases.
Expected behavior
IMHO there should be no difference between the two cases. Also, if using self.add
is discouraged for objects that have updaters, we might consider printing a warning.
How to reproduce the issue
See the following code:
Code running with no lagging
from manim import *
class Test(Scene):
def construct(self):
tracker = ValueTracker(-3)
rect = Rectangle().set_x(tracker.get_value())
label = Text("x")
rect.add_updater(lambda m: m.set_x(tracker.get_value()))
label.add_updater(lambda m: m.move_to(rect.get_center()))
self.add(rect,label)
self.play(tracker.animate.set_value(4))
self.wait()
self.play(FadeIn(rect))
self.play(tracker.animate.set_value(-4))
self.wait()
Lagging animation in the second part
from manim import *
class Test(Scene):
def construct(self):
tracker = ValueTracker(-3)
rect = Rectangle().set_x(tracker.get_value())
label = Text("x")
rect.add_updater(lambda m: m.set_x(tracker.get_value()))
label.add_updater(lambda m: m.move_to(rect.get_center()))
self.add(rect,label)
self.play(tracker.animate.set_value(4))
self.wait()
#self.play(FadeIn(rect))
self.add(rect)
self.play(tracker.animate.set_value(-4))
self.wait()
Additional media files
Test.mp4
Metadata
Metadata
Assignees
Labels
help wantedWe would appreciate help on this issue/PRWe would appreciate help on this issue/PRissue:bugSomething isn't working... For use in issuesSomething isn't working... For use in issues
Type
Projects
Status
🆕 New