我不知道如何用新的Manim版本(v0.2.0)创建简单的动画。例如,我想要将一个圆移动到一个边,同时缩放它。
在以前的版本中,我会这样做:
class CircleAnimations(Scene):
def construct(self):
circle = Circle()
self.add(circle)
self.play(
circle.scale, 0.2,
circle.to_edge, UP
)
self.wait()但由于在新版本中,为了在self.play方法中设置动画,我们必须使用mobj.animate.method(parameters),所以我尝试重写self.play方法,如下所示:
self.play(
circle.animate.scale(0.2),
circle.animate.to_edge(UP)
)但是,这并不起作用:它似乎只运行第一个方法,在本例中是circle.animate.scale(0.2),而不是同时运行circle.animate.scale(0.2)和circle.animate.to_edge(UP)
有什么解决方案吗?提前谢谢。
发布于 2021-01-21 15:29:08
您可以像这样嵌套动画:
self.play(
circle.animate.scale(0.2).to_edge(UP)
)另一种方法是使用ApplyMethod类:
self.play(
ApplyMethod(circle.scale, 0.2),
ApplyMethod(circle.to_edge, UP)
)https://stackoverflow.com/questions/65794681
复制相似问题