我正在努力学习如何使用manim
。我一直在研究我认为是标准的tutorial。我现在从manim的documentation中获取一些代码(不是教程)。你知道吗
我运行的代码如下(取自第一个示例,但添加了import命令):
from manimlib.imports import *
class SquareToCircle(Scene):
def construct(self):
circle = Circle()
square = Square()
square.flip(RIGHT)
square.rotate(-3 * TAU / 8)
circle.set_fill(PINK, opacity=0.5)
self.play(ShowCreation(square))
self.play(Transform(square, circle))
self.play(FadeOut(square))
我从命令行运行它
$ manim SquareToCircle.py
Media will be stored in ./media/. You can change this behavior by writing a different directory to media_dir.txt.
1: Banner
2: ComplexTransformationScene
3: CountInBinaryTo256
4: CountInDecimal
5: CountInTernary
6: CountingScene
7: DiscreteGraphScene
8: ExternallyAnimatedScene
9: FactorialBase
10: GraphScene
etc
25: SquareToCircle
etc
Choose number corresponding to desired scene/arguments.
(Use comma separated list for multiple entries)
Choice(s):
当我选择25时,它运行并产生预期的输出。但是其他的选择从何而来呢?有没有办法避免他们出现?你知道吗
我认为出现菜单是因为您没有在命令行中指定要渲染的场景。您可以在一个python文件中创建多个场景,场景的名称就是您所称的类。试试
$ manim SquareToCircle.py SquareToCircle
。 我认为菜单是一些示例文件中的场景。你知道吗要仅查看文件中的场景,请执行以下操作:
is_child_scene
方法,这是您应该拥有的方法:有了这个:
有关此问题的详细信息here。你知道吗
相关问题 更多 >
编程相关推荐