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


Python VMobject.highlight方法代码示例

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


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

示例1: introduce_coordinate_plane

# 需要导入模块: from mobject.vectorized_mobject import VMobject [as 别名]
# 或者: from mobject.vectorized_mobject.VMobject import highlight [as 别名]
    def introduce_coordinate_plane(self):
        plane = NumberPlane()
        x_axis, y_axis = plane.get_axes().copy().split()
        x_label, y_label = plane.get_axis_labels().split()
        number_line = NumberLine(tick_frequency = 1)
        x_tick_marks = number_line.get_tick_marks()
        y_tick_marks = x_tick_marks.copy().rotate(np.pi/2)
        tick_marks = VMobject(x_tick_marks, y_tick_marks)
        tick_marks.highlight(WHITE)
        plane_lines = filter(
            lambda m : isinstance(m, Line),
            plane.submobject_family()
        )
        origin_words = TextMobject("Origin")
        origin_words.shift(2*UP+2*LEFT)
        dot = Dot(radius = 0.1).highlight(RED)
        line = Line(origin_words.get_bottom(), dot.get_corner(UP+LEFT))

        unit_brace = Brace(Line(RIGHT, 2*RIGHT))
        one = TexMobject("1").next_to(unit_brace, DOWN)

        self.add(x_axis, x_label)
        self.dither()
        self.play(ShowCreation(y_axis))
        self.play(Write(y_label, run_time = 1))
        self.dither(2)
        self.play(
            Write(origin_words),
            GrowFromCenter(dot),
            ShowCreation(line),
            run_time = 1
        )
        self.dither(2)
        self.play(
            FadeOut(VMobject(origin_words, dot, line))
        )
        self.remove(origin_words, dot, line)
        self.dither()
        self.play(
            ShowCreation(tick_marks, submobject_mode = "one_at_a_time")
        )
        self.play(
            GrowFromCenter(unit_brace),
            Write(one, run_time = 1)            
        )
        self.dither(2)
        self.remove(unit_brace, one)
        self.play(
            *map(GrowFromCenter, plane_lines) + [
            Animation(x_axis), Animation(y_axis)
        ])
        self.dither()
        self.play(
            FadeOut(plane),
            Animation(VMobject(x_axis, y_axis, tick_marks))
        )
        self.remove(plane)
        self.add(tick_marks)
开发者ID:namkam5,项目名称:manim,代码行数:60,代码来源:chapter1.py


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