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


Python Mobject.center方法代码示例

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


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

示例1: construct

# 需要导入模块: from mobject import Mobject [as 别名]
# 或者: from mobject.Mobject import center [as 别名]
    def construct(self):
        words, s = TextMobject(["Pseudo-Hilbert Curve", "s"]).split()
        pre_words = TextMobject("Order 1")
        pre_words.next_to(words, LEFT, buff = 0.5)
        s.next_to(words, RIGHT, buff = 0.05, aligned_edge = DOWN)
        cluster = Mobject(pre_words, words, s)
        cluster.center()
        cluster.scale(0.7)
        cluster.to_edge(UP, buff = 0.3)
        cluster.highlight(GREEN)
        grid1 = Grid(1, 1)
        grid2 = Grid(2, 2)
        curve = HilbertCurve(order = 1)

        self.add(words, s)
        self.dither()
        self.play(Transform(
            s, pre_words, 
            path_func = path_along_arc(-np.pi/3)
        ))
        self.dither()
        self.play(ShowCreation(grid1))
        self.dither()
        self.play(ShowCreation(grid2))
        self.dither()
        kwargs = {
            "run_time" : 5,
            "rate_func" : None
        }
        self.play(ShowCreation(curve, **kwargs))
        self.dither()
开发者ID:GodotMisogi,项目名称:manim,代码行数:33,代码来源:section1.py

示例2: get_triangles

# 需要导入模块: from mobject import Mobject [as 别名]
# 或者: from mobject.Mobject import center [as 别名]
 def get_triangles(self):
     triangle = Polygon(
         LEFT/np.sqrt(3),
         UP,
         RIGHT/np.sqrt(3),
         color = GREEN
     )
     triangles = Mobject(
         triangle.copy().scale(0.5).shift(LEFT),
         triangle,
         triangle.copy().scale(0.3).shift(0.5*UP+RIGHT)
     )
     triangles.center()
     return triangles
开发者ID:Rubixdarcy,项目名称:manim,代码行数:16,代码来源:section3.py


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