Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions manim/animation/rotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
Loading