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


Python Mobject.scale_to_fit_width方法代码示例

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


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

示例1: construct

# 需要导入模块: from mobject import Mobject [as 别名]
# 或者: from mobject.Mobject import scale_to_fit_width [as 别名]
    def construct(self, with_words):
        CycloidScene.construct(self)

        randy = Randolph()
        randy.scale(RANDY_SCALE_VAL)
        randy.shift(-randy.get_bottom())
        central_randy = randy.copy()
        start_randy = self.adjust_mobject_to_index(
            randy.copy(), 1, self.cycloid.points
        )

        if with_words:
            words1 = TextMobject("Trajectory due to gravity")
            arrow = TexMobject("\\leftrightarrow")
            words2 = TextMobject("Trajectory due \\emph{constantly} rotating wheel")
            words1.next_to(arrow, LEFT)
            words2.next_to(arrow, RIGHT)
            words = Mobject(words1, arrow, words2)
            words.scale_to_fit_width(2*SPACE_WIDTH-1)
            words.to_edge(UP, buff = 0.2)
            words.to_edge(LEFT)

        self.play(ShowCreation(self.cycloid.copy()))
        self.slide(randy, self.cycloid)
        self.add(self.slider)
        self.dither()
        self.grow_parts()
        self.draw_cycloid()
        self.dither()
        self.play(Transform(self.slider, start_randy))
        self.dither()
        self.roll_back()
        self.dither()
        if with_words:
            self.play(*map(ShimmerIn, [words1, arrow, words2]))
        self.dither()
        self.remove(self.circle)
        start_time = len(self.frames)*self.frame_duration
        self.remove(self.slider)        
        self.slide(central_randy, self.cycloid)
        end_time = len(self.frames)*self.frame_duration
        self.play_over_time_range(
            start_time,
            end_time,
            RollAlongVector(
                self.circle, 
                self.cycloid.points[-1]-self.cycloid.points[0],
                run_time = end_time-start_time,
                rate_func = None
            )
        )
        self.add(self.circle, self.slider)
        self.dither()
开发者ID:GodotMisogi,项目名称:manim,代码行数:55,代码来源:cycloid.py


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