From 6233cf6846e9d9ca907c945a5dae476b635e133b Mon Sep 17 00:00:00 2001 From: orv0005 <tomas.orvisky.st@vsb.cz> Date: Mon, 22 Apr 2024 00:50:37 +0000 Subject: [PATCH] example --- examples/manim/updater_scene.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 examples/manim/updater_scene.py diff --git a/examples/manim/updater_scene.py b/examples/manim/updater_scene.py new file mode 100644 index 0000000..703744a --- /dev/null +++ b/examples/manim/updater_scene.py @@ -0,0 +1,30 @@ +from manim import * + + +class ExampleUpdater(Scene): + def construct(self): + self.camera.background_color = WHITE + Text.set_default(color=BLACK) + + rect = Rectangle(color=BLUE) + circle = Circle(color=RED, fill_color=GREEN, fill_opacity=1) + text = Text('Manim') + rect_and_circle_group = VGroup(rect, circle) + + def text_follow_updater(mobj: Mobject): + mobj.move_to(rect.get_center()) + + text.add_updater(text_follow_updater) + + rect.shift(DOWN * 1.5) + circle.next_to(rect, UP) + text.move_to(rect.get_center()) + + self.add(rect, circle, text) + + self.play(rect.animate.shift(RIGHT * 2)) + + self.play(ScaleInPlace(rect_and_circle_group, 0.75)) + self.play(rect_and_circle_group.animate.shift(UL * 2)) + + self.wait(3) -- GitLab