Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Bugfix: make sure last frame for animations with updaters is correct (#983)

sparshgdcef4077c44a
diff --git a/manim/scene/scene.py b/manim/scene/scene.py
index 47566fb23..8f40fd42f 100644
--- a/manim/scene/scene.py
+++ b/manim/scene/scene.py
@@ -849,6 +849,8 @@ class Scene(Container):
for animation in self.animations:
animation.finish()
animation.clean_up_from_scene(self)
+ if not self.renderer.skip_animations:
+ self.update_mobjects(0)
self.renderer.static_image = None
def update_to_time(self, t):
diff --git a/tests/control_data/graphical_units_data/updaters/LastFrameWhenClearedTest.npz b/tests/control_data/graphical_units_data/updaters/LastFrameWhenClearedTest.npz
new file mode 100644
index 000000000..277bcc947
Binary files /dev/null and b/tests/control_data/graphical_units_data/updaters/LastFrameWhenClearedTest.npz differ
diff --git a/tests/test_graphical_units/test_updaters.py b/tests/test_graphical_units/test_updaters.py
index addb95046..2ae745d2d 100644
--- a/tests/test_graphical_units/test_updaters.py
+++ b/tests/test_graphical_units/test_updaters.py
@@ -33,6 +33,17 @@ class UpdateSceneDuringAnimationTest(Scene):
self.play(ShowCreation(s))
+class LastFrameWhenClearedTest(Scene):
+ def construct(self):
+ dot = Dot()
+ square = Square()
+ square.add_updater(lambda m: m.move_to(dot, UL))
+ self.add(square)
+ self.play(dot.animate.shift(UP * 2), rate_func=linear)
+ square.clear_updaters()
+ self.wait()
+
+
MODULE_NAME = "updaters"