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


Python TexMobject.arrange_submobjects方法代码示例

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


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

示例1: construct

# 需要导入模块: from mobject.tex_mobject import TexMobject [as 别名]
# 或者: from mobject.tex_mobject.TexMobject import arrange_submobjects [as 别名]
    def construct(self):
        v_color = MAROON_C
        w_color = BLUE

        definition = TextMobject("""
            The ``span'' of $\\vec{\\textbf{v}}$ and 
            $\\vec{\\textbf{w}}$ is the \\\\ set of all their
            linear combinations.
        """)
        definition.scale_to_fit_width(2*SPACE_WIDTH-1)
        definition.to_edge(UP)
        def_mobs = np.array(definition.split())
        VMobject(*def_mobs[4:4+4]).highlight(PINK)
        VMobject(*def_mobs[11:11+2]).highlight(v_color)
        VMobject(*def_mobs[16:16+2]).highlight(w_color)
        VMobject(*def_mobs[-19:-1]).highlight(YELLOW)

        equation = TexMobject([
            "a", "\\vec{\\textbf{v}}", "+", "b", "\\vec{\\textbf{w}}"
        ])
        equation.arrange_submobjects(buff = 0.1, aligned_edge = DOWN)
        equation.split()[1].highlight(v_color)
        equation.split()[4].highlight(w_color)
        a, b = np.array(equation.split())[[0, 3]]
        equation.scale(2)
        equation.next_to(definition, DOWN, buff = 1)

        vary_words = TextMobject(
            "Let $a$ and $b$ vary \\\\ over all real numbers"
        )
        vary_words.scale(1.5)
        vary_words.next_to(equation, DOWN, buff = 2)
        arrows = [
            Arrow(vary_words, letter)
            for letter in a, b
        ]

        self.play(Write(definition))
        self.play(Write(equation))
        self.dither()
        self.play(
            FadeIn(vary_words),
            ShowCreation(VMobject(*arrows))
        )
        self.dither()
开发者ID:PythonJedi,项目名称:manim,代码行数:47,代码来源:chapter2.py


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