diff --git a/manim/animation/rotation.py b/manim/animation/rotation.py index f47b0b6945..b221051099 100644 --- a/manim/animation/rotation.py +++ b/manim/animation/rotation.py @@ -146,6 +146,40 @@ def construct(self): Rotate(Square(side_length=0.5), angle=2*PI, rate_func=linear), ) + + .. manim:: DifferenceBetweenRotateAndRotating + + class DifferenceBetweenRotateAndRotating(Scene): + def construct(self): + s = Square(color= GREEN) + scenter= s.get_center() + d = Dot(color = BLUE).move_to(s.get_corner(UP+RIGHT)) + rotatelabel = Text("Rotate",color=PURE_YELLOW) + s.add(d) + s.save_state() + s.add(rotatelabel) + + self.add(TracedPath(d.get_center,stroke_width = 3,stroke_color=PURE_YELLOW)) + #If no path_arc is given explicitly in the line below, + #then there is no difference in the output of Rotate and Rotating. + self.add(Text("Path Arc is PI",color = PURE_YELLOW).scale(0.8).shift(2*DOWN)) + self.play(Rotate(s, angle=2*PI,rate_func =linear,path_arc = PI, run_time = 3, about_point=scenter)) + self.wait() + self.remove(*self.mobjects) + + self.add(TracedPath(d.get_center,stroke_width = 3,stroke_color=PURE_YELLOW)) + self.add(Text("Path Arc is None",color = PURE_YELLOW).scale(0.8).shift(2*DOWN)) + self.play(Rotate(s, angle=2*PI,rate_func =linear, run_time = 3, about_point=scenter)) + self.wait() + self.remove(*self.mobjects) + + s.restore() + rotatinglabel = Text("Rotating",color=ORANGE).scale_to_fit_width(s.get_width()) + s.add(rotatinglabel) + self.add(TracedPath(d.get_center,stroke_width = 3,stroke_color=ORANGE)) + self.play(Rotating(s, angle = 2*PI, rate_func = linear, about_point=scenter,run_time = 3)) + self.wait() + See also -------- :class:`~.Rotating`, :meth:`~.Mobject.rotate`