Skip to content

Commit f42bd05

Browse files
authored
Updaters fix (#838)
* Fix --use_js_renderer and create JsRenderer * In need of an abstract method for saving static frame data * Barebones js renderer with no effect * Restore simple JS functionality * Preparing to send frame data to JS * Restore progress after merge * Restore ability to play animations * Properly set wait duration * Pass animation_offset to JS * Allow for playing a range of animations * Update RPCs * Play scene on modification * Send correct duration to JS on animation finish * Copy keyframes prior to updating * Play scene on update * Allow for image previews * Don't attempt to serialize ValueTracker * Cache previously used scene * Add ImageMobject functionality * Clear scene caching when regenerating keyframe data * Remove extraneous changes * Update for doctests * Format generated files * Add http server for media * Update moving_mobjects in Scene.add() * Remove unused function * black * Add test
1 parent ffd8b42 commit f42bd05

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

manim/scene/scene.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,11 @@ def add(self, *mobjects):
319319
mobjects = [*mobjects, *self.foreground_mobjects]
320320
self.restructure_mobjects(to_remove=mobjects)
321321
self.mobjects += mobjects
322+
if self.moving_mobjects:
323+
self.restructure_mobjects(
324+
to_remove=mobjects, mobject_list_name="moving_mobjects"
325+
)
326+
self.moving_mobjects += mobjects
322327
return self
323328

324329
def add_mobjects_from_animations(self, animations):
Binary file not shown.

tests/test_graphical_units/test_updaters.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ def construct(self):
2424
line_2.rotate(theta.get_value(), about_point=ORIGIN)
2525

2626

27+
class UpdateSceneDuringAnimationTest(Scene):
28+
def construct(self):
29+
def f(mob):
30+
self.add(Square())
31+
32+
s = Circle().add_updater(f)
33+
self.play(ShowCreation(s))
34+
35+
2736
MODULE_NAME = "updaters"
2837

2938

0 commit comments

Comments
 (0)