当前位置: 首页>>代码示例>>Python>>正文


Python Mobject.get_full_submobject_family方法代码示例

本文整理汇总了Python中mobject.Mobject.get_full_submobject_family方法的典型用法代码示例。如果您正苦于以下问题:Python Mobject.get_full_submobject_family方法的具体用法?Python Mobject.get_full_submobject_family怎么用?Python Mobject.get_full_submobject_family使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mobject.Mobject的用法示例。


在下文中一共展示了Mobject.get_full_submobject_family方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: play

# 需要导入模块: from mobject import Mobject [as 别名]
# 或者: from mobject.Mobject import get_full_submobject_family [as 别名]
    def play(self, *animations, **kwargs):
        if "run_time" in kwargs:
            run_time = kwargs["run_time"]
        else:
            run_time = animations[0].run_time
        for animation in animations:
            animation.set_run_time(run_time)
        moving_mobjects = [
            mobject
            for anim in animations
            for mobject in anim.mobject.get_full_submobject_family()
        ]

        bundle = Mobject(*self.mobjects)
        static_mobjects = filter(
            lambda m : m not in moving_mobjects, 
            bundle.get_full_submobject_family()
        )
        background = disp.paint_mobjects(
            static_mobjects,
            self.background,
            include_sub_mobjects = False
        )

        print "Generating " + ", ".join(map(str, animations))
        progress_bar = progressbar.ProgressBar(maxval=run_time)
        progress_bar.start()

        for t in np.arange(0, run_time, self.frame_duration):
            progress_bar.update(t)
            for animation in animations:
                animation.update(t / animation.run_time)
            new_frame = disp.paint_mobjects(moving_mobjects, background)
            self.frames.append(new_frame)
        for animation in animations:
            animation.clean_up()
        self.add(*moving_mobjects)
        self.repaint_mojects()
        progress_bar.finish()
        return self
开发者ID:mherkazandjian,项目名称:manim,代码行数:42,代码来源:scene.py


注:本文中的mobject.Mobject.get_full_submobject_family方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。