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


Python Mobject.submobject_family方法代码示例

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


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

示例1: play

# 需要导入模块: from mobject import Mobject [as 别名]
# 或者: from mobject.Mobject import submobject_family [as 别名]
    def play(self, *animations, **kwargs):
        self.num_animations += 1
        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.submobject_family()]

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

        times = np.arange(0, run_time, self.frame_duration)
        time_progression = ProgressDisplay(times)
        time_progression.set_description(
            "Animation %d: " % self.num_animations + str(animations[0]) + (", etc." if len(animations) > 1 else "")
        )
        for t in time_progression:
            for animation in animations:
                animation.update(t / animation.run_time)
            new_frame = disp.paint_mobjects([anim.mobject for anim in animations], background)
            self.frames.append(new_frame)
        for animation in animations:
            animation.clean_up()
        self.add(*[anim.mobject for anim in animations])
        self.repaint_mojects()
        return self
开发者ID:Rubixdarcy,项目名称:manim,代码行数:31,代码来源:scene.py

示例2: separate_moving_and_static_mobjects

# 需要导入模块: from mobject import Mobject [as 别名]
# 或者: from mobject.Mobject import submobject_family [as 别名]
 def separate_moving_and_static_mobjects(self, *animations):
     moving_mobjects = list(it.chain(*[
         anim.mobject.submobject_family()
         for anim in animations
     ]))
     bundle = Mobject(*self.mobjects)
     static_mobjects = filter(
         lambda m : m not in moving_mobjects, 
         bundle.submobject_family()
     )
     return moving_mobjects, static_mobjects
开发者ID:namkam5,项目名称:manim,代码行数:13,代码来源:scene.py


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