A community-maintained Python framework for creating mathematical animations.
Added rotation example to example gallery (#1204)
kolibril1390782e302a5b
diff --git a/docs/source/examples.rst b/docs/source/examples.rstindex c234ee329..aaaca1ea6 100644--- a/docs/source/examples.rst+++ b/docs/source/examples.rst@@ -214,6 +214,55 @@ Animationsself.play(square.animate.scale(0.3))self.play(square.animate.rotate(0.4))+.. manim:: MovingAngle+ :ref_classes: Angle+ :ref_functions: Mobject.rotate++ class MovingAngle(Scene):+ def construct(self):+ rotation_center = LEFT++ theta_tracker = ValueTracker(110)+ line1 = Line(LEFT, RIGHT)+ line_moving = Line(LEFT, RIGHT)+ line_ref = line_moving.copy()+ line_moving.rotate(+ theta_tracker.get_value() * DEGREES, about_point=rotation_center+ )+ a = Angle(line1, line_moving, radius=0.5, other_angle=False)+ te = MathTex(r"\theta").move_to(+ Angle(+ line1, line_moving, radius=0.5 + 3 * SMALL_BUFF, other_angle=False+ ).point_from_proportion(0.5)+ )++ self.add(line1, line_moving, a, te)+ self.wait()++ line_moving.add_updater(+ lambda x: x.become(line_ref.copy()).rotate(+ theta_tracker.get_value() * DEGREES, about_point=rotation_center+ )+ )++ a.add_updater(+ lambda x: x.become(Angle(line1, line_moving, radius=0.5, other_angle=False))+ )+ te.add_updater(+ lambda x: x.move_to(+ Angle(+ line1, line_moving, radius=0.5 + 3 * SMALL_BUFF, other_angle=False+ ).point_from_proportion(0.5)+ )+ )++ self.play(theta_tracker.animate.set_value(40))+ self.play(theta_tracker.animate.increment_value(140))+ self.play(te.animate.set_color(RED), run_time=0.5)+ self.play(theta_tracker.animate.set_value(350))+++.. manim:: MovingGroupToDestinationclass MovingGroupToDestination(Scene):