章节
除了影片输出文件之外,还可以使用章节。每个章节都会生成它自己的输出视频。两个部分之间的剪辑可以像这样设置:
def construct(self):
# play the first animations...
# you don't need a section in the very beginning as it gets created automatically
self.next_section()
# play more animations...
self.next_section("this is an optional name that doesn't have to be unique")
# play even more animations...
self.next_section("this is a section without any animations, it will be removed")其中两个剪辑之间的所有动画都连接到一个输出video 文件中。请注意,每个部分至少需要一个动画。例如,这不会创建输出视频:
def construct(self):
self.next_section()
# this section doesn't have any animations and will be removed
# but no error will be thrown
# feel free to tend your flock of empty sections if you so desire
self.add(Circle())
self.next_section()解决此问题的一种方法是稍等片刻:
def construct(self):
self.next_section()
self.add(Circle())
# now we wait 1sec and have an animation to satisfy the section
self.wait()
self.next_section()对于每个部分要创建的视频,您必须将标志--save_sections添加到 Manim 调用中,如下所示:
如果您这样做,media文件夹将如下所示:
如您所见,每个部分都会在sections目录中接收自己的输出视频。 此处的 JSON 文件包含每个部分的一些有用信息:
这些数据可供第三方应用程序使用,例如演示系统或自动视频编辑工具。
你也可以跳过渲染属于某个部分的所有动画,如下所示:
Last updated