Rotation

声明

这一页翻译自elteoremadebeethoven的 manim_3feb_docs

由鹤翔万里补充

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)

请不要尝试直接使用 ApplyMethodself.play(mob.rotate, ...) 来旋转, 因为这只是在当前和结果之间进行 Transform ,并无旋转效果