首页 > 解决方案 > 在 manim 中发出带有 play() 函数的问题

问题描述

我运行这段代码:

from manimlib import *

class SquareToCircle(Scene):
    def construct(self):
        circle = Circle()
        self.play(ShowCreation(circle))
        self.play(circle.animate.shift(2 * RIGHT), circle.animate.scale(0.25))

它是来自https://3b1b.github.io/manim/getting_started/quickstart.html的缩短示例。但是,圆圈​​不会按照此处circle.animate.shift(2 * RIGHT)所示的指定向右移动。

标签: pythonpython-3.xmanim

解决方案


我找到了同时做两个动画的正确方法

from manimlib import *

class SquareToCircle(Scene):
    def construct(self):
        circle = Circle()
        self.play(ShowCreation(circle))
        self.play(circle.animate.shift(2 * RIGHT).scale(0.25))

https://youtu.be/dwovjxTcvEk


推荐阅读