Skip to content

Commit

Permalink
Add example for 3D rotation by Rotating class
Browse files Browse the repository at this point in the history
  • Loading branch information
irvanalhaq9 committed Feb 4, 2025
1 parent f7e2588 commit 5849201
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions manim/animation/rotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ def construct(self):
anim_kwargs = {"rate_func": linear, "run_time": 1}
self.play(Rotating(arrow, radians=PI, about_point=arrow.get_start()), **anim_kwargs)
self.play(Rotating(arrow, radians=180 * DEGREES, about_point=arrow.get_start()), **anim_kwargs)
.. manim:: Rotating3D
class Rotating3D(ThreeDScene):
def construct(self):
axes = ThreeDAxes()
cube = Cube()
line2d = Arrow(start=[0, -1.2, 1], end=[0, 1.2, 1], color=YELLOW_E)
cube_group = VGroup(cube,line2d)
self.set_camera_orientation(gamma=0*DEGREES, phi=40*DEGREES, theta=40*DEGREES)
self.add(axes, cube_group)
self.play(Rotating(cube_group, radians=2*PI, axis=UP), run_time=3, rate_func=linear)
See also
--------
Expand Down
2 changes: 1 addition & 1 deletion manim/mobject/mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,7 @@ def dot_position(mobject):
label.add_updater(dot_position)
self.add(dot, label)
self.play(Rotating(dot, about_point=ORIGIN, run_time=TAU, rate_func=linear))
self.play(Rotating(dot, about_point=ORIGIN, radians=TAU, run_time=TAU, rate_func=linear))
.. manim:: DtUpdater
Expand Down

0 comments on commit 5849201

Please sign in to comment.