问题描述
我在使用社区 manim 时遇到了一个奇怪的问题。我已经安装了所有的帮助文件,所以我只需要安装 manim,它似乎工作正常。但是,我看到了一些我不明白的奇怪行为。这是一个调用scene.py 的示例程序(两个示例均取自社区Manim 文档):
from manim import *
class CreatingMobjects(Scene):
def construct(self):
circle = Circle()
self.add(circle)
self.wait(1)
self.remove(circle)
self.wait(1)
class VectorArrow(Scene):
def construct(self):
dot = Dot(ORIGIN)
arrow = Arrow(ORIGIN,[2,2,0],buff=0)
numberplane = NumberPlane()
origin_text = Text('(0,0)').next_to(dot,DOWN)
tip_text = Text('(2,2)').next_to(arrow.get_end(),RIGHT)
self.add(numberplane,dot,arrow,origin_text,tip_text)
当我运行命令 python -m manim scene.py CreatingMobjects -p -ql
时,一切正常,电影按原样弹出。但是,如果我运行命令 python -m manim scene.py VectorArrow -p -ql
,它不起作用。屏幕上打印的第一件事是 ./manim/media/videos/scene/480p15/partial_movie_files/VectorArrow/partial_movie_file_list.txt: Invalid data found when processing input
然后它说 The file ./manim/media/videos/scene/480p15/VectorArrow.mp4 does not exist.
我真的很困惑为什么其中一个有效而另一个无效。我对 manim 很陌生(显然),我认为这些非常简单的例子是一个很好的起点,但我已经不明白发生了什么。任何帮助将不胜感激。
解决方法
在 self.wait(1)
之后添加 self.add(numberplane,dot,arrow,origin_text,tip_text)
。
然后脚本应该可以工作。