Rotation¶
Rotating¶
-
class
manimlib.animation.rotation.
Rotating
(mobject: Mobject, angle: float = 6.283185307179586, axis: np.ndarray = array([0., 0., 1.]), **kwargs)¶
RotatingExample¶
class RotatingExample(Scene):
def construct(self):
square=Square().scale(2)
self.add(square)
self.play(
Rotating(
square,
angle=PI/4,
run_time=2
)
)
self.wait(0.3)
self.play(
Rotating(
square,
angle=PI,
run_time=2,
axis=RIGHT
)
)
self.wait(0.3)
Rotate¶
-
class
manimlib.animation.rotation.
Rotate
(mobject: Mobject, angle: float = 3.141592653589793, axis: np.ndarray = array([0., 0., 1.]), **kwargs)¶
RotateExample¶
class RotateExample(Scene):
def construct(self):
square=Square().scale(2)
self.add(square)
self.play(
Rotate(
square,
PI/4,
run_time=2
)
)
self.wait(0.3)
self.play(
Rotate(
square,
PI,
run_time=2,
axis=RIGHT
)
)
self.wait(0.3)
请不要尝试直接使用 ApplyMethod
或 self.play(mob.rotate, ...)
来旋转,
因为这只是在当前和结果之间进行 Transform
,并无旋转效果