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


Python TextMobject.get_left方法代码示例

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


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

示例1: solve_energy

# 需要导入模块: from mobject.tex_mobject import TextMobject [as 别名]
# 或者: from mobject.tex_mobject.TextMobject import get_left [as 别名]
    def solve_energy(self):
        loss_in_potential = TextMobject("Loss in potential: ")
        loss_in_potential.shift(2*UP)
        potential = TexMobject("m g y".split())
        potential.next_to(loss_in_potential)
        kinetic = TexMobject([
            "\\dfrac{1}{2}","m","v","^2","="
        ])
        kinetic.next_to(potential, LEFT)
        nudge = 0.1*UP
        kinetic.shift(nudge)
        loss_in_potential.shift(nudge)
        ms = Mobject(kinetic.split()[1], potential.split()[0])
        two = TexMobject("2")
        two.shift(ms.split()[1].get_center())
        half = kinetic.split()[0]
        sqrt = TexMobject("\\sqrt{\\phantom{2mg}}")
        sqrt.shift(potential.get_center())
        nudge = 0.2*LEFT
        sqrt.shift(nudge)
        squared = kinetic.split()[3]
        equals = kinetic.split()[-1]
        new_eq = equals.copy().next_to(kinetic.split()[2])

        self.play(
            Transform(
                Point(loss_in_potential.get_left()),
                loss_in_potential
            ),
            *map(GrowFromCenter, potential.split())
        )
        self.dither(2)
        self.play(
            FadeOut(loss_in_potential),
            GrowFromCenter(kinetic)
        )
        self.dither(2)
        self.play(ApplyMethod(ms.shift, 5*UP))
        self.dither()
        self.play(Transform(
            half, two, 
            path_func = counterclockwise_path()
        ))
        self.dither()
        self.play(
            Transform(
                squared, sqrt, 
                path_func = clockwise_path()
            ),
            Transform(equals, new_eq)
        )
        self.dither(2)
开发者ID:GodotMisogi,项目名称:manim,代码行数:54,代码来源:curves.py

示例2: construct

# 需要导入模块: from mobject.tex_mobject import TextMobject [as 别名]
# 或者: from mobject.tex_mobject.TextMobject import get_left [as 别名]
    def construct(self):
        snells = TextMobject("Snell's")
        snells.shift(-snells.get_left())
        snells.to_edge(UP)
        for vect in [RIGHT, RIGHT, LEFT, DOWN, DOWN, DOWN]:
            snells.add(snells.copy().next_to(snells, vect))
        snells.ingest_submobjects()
        snells.show()
        condensed = TextMobject("condensed")

        self.add(snells)
        self.dither()
        self.play(DelayByOrder(
            Transform(snells, condensed, run_time = 2)
        ))
        self.dither()
开发者ID:GodotMisogi,项目名称:manim,代码行数:18,代码来源:wordplay.py


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