templates

class janim.timeline.templates.SourceTimeline(*args, **kwargs)

基类:Timeline

与 Timeline 相比,会在背景显示源代码

source_object() → object
build(*, quiet=False, hide_subtitles=False, show_debug_notice=False) → BuiltTimeline

构建动画并返回

class janim.timeline.templates.ListedTimelines(*args, **kwargs)

基类:Timeline

指定一组 Timeline 实现,将他们依次播放

示例:

class Section0(Timeline):
    def construct(self):
        ...

class Section1(Timeline):
    def construct(self):
        ...

class Section2(Timeline):
    def construct(self):
        ...

class Sections(ListedTimelines):
    includes = [Section1, Section2]
includes: list[type[Timeline]] = []
construct()
class janim.timeline.templates.AboveTimelines(*args, **kwargs)

基类:ListedTimelines

依次播放在同文件中先前定义过的所有 Timeline 实现

示例:

class Section0(Timeline):
    def construct(self):
        ...

class Section1(Timeline):
    def construct(self):
        ...

class Section2(Timeline):
    def construct(self):
        ...

class Sections(AboveTimelines):
    pass

可另外使用 excludes 指定排除项

示例:

...

class Sections(AboveTimelines):
    excludes = [Section0]
excludes: list[type[Timeline]] = []
construct()