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


Python TexMobject.get_corner方法代码示例

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


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

示例1: get_coordinate_labels

# 需要导入模块: from mobject.tex_mobject import TexMobject [as 别名]
# 或者: from mobject.tex_mobject.TexMobject import get_corner [as 别名]
 def get_coordinate_labels(self, x_vals=None, y_vals=None):
     result = []
     nudge = 0.1 * (DOWN + RIGHT)
     if x_vals == None and y_vals == None:
         x_vals = range(-int(self.x_radius), int(self.x_radius))
         y_vals = range(-int(self.y_radius), int(self.y_radius))
     for index, vals in zip([0, 1], [x_vals, y_vals]):
         num_pair = [0, 0]
         for val in vals:
             num_pair[index] = val
             point = self.num_pair_to_point(num_pair)
             num = TexMobject(str(val))
             num.scale(self.number_scale_factor)
             num.shift(point - num.get_corner(UP + LEFT) + nudge)
             result.append(num)
     return result
开发者ID:Rubixdarcy,项目名称:manim,代码行数:18,代码来源:number_line.py

示例2: get_coordinate_labels

# 需要导入模块: from mobject.tex_mobject import TexMobject [as 别名]
# 或者: from mobject.tex_mobject.TexMobject import get_corner [as 别名]
 def get_coordinate_labels(self, x_vals = None, y_vals = None):
     result = []
     if x_vals == None and y_vals == None:
         x_vals = range(-int(self.x_radius), int(self.x_radius))
         y_vals = range(-int(self.y_radius), int(self.y_radius))
     for index, vals in enumerate([x_vals, y_vals]):
         num_pair = [0, 0]
         for val in vals:
             num_pair[index] = val
             point = self.num_pair_to_point(num_pair)
             num = TexMobject(str(val))
             num.scale_to_fit_height(
                 self.written_coordinate_height
             )
             num.shift(
                 point-num.get_corner(UP+LEFT),
                 self.written_coordinate_nudge
             )
             result.append(num)
     return result
开发者ID:xhrwang,项目名称:manim,代码行数:22,代码来源:number_line.py

示例3: get_coordinate_labels

# 需要导入模块: from mobject.tex_mobject import TexMobject [as 别名]
# 或者: from mobject.tex_mobject.TexMobject import get_corner [as 别名]
 def get_coordinate_labels(self, *numbers):
     result = []
     nudge = 0.1*(DOWN+RIGHT)
     if len(numbers) == 0:
         numbers = range(-int(self.x_radius), int(self.x_radius))
         numbers += [
             complex(0, y)
             for y in range(-int(self.y_radius), int(self.y_radius))
         ]
     for number in numbers:
         point = self.number_to_point(number)
         if number == 0:
             num_str = "0"
         else:
             num_str = str(number).replace("j", "i")
         num = TexMobject(num_str)
         num.scale(self.number_scale_factor)
         num.shift(point-num.get_corner(UP+LEFT)+nudge)
         result.append(num)
     return result
开发者ID:crclayton,项目名称:manim,代码行数:22,代码来源:complex_numbers.py

示例4: construct

# 需要导入模块: from mobject.tex_mobject import TexMobject [as 别名]
# 或者: from mobject.tex_mobject.TexMobject import get_corner [as 别名]
    def construct(self):
        top = TOP()
        times = top.put_in_vertex(0, TexMobject("\\times"))
        times.highlight(YELLOW)
        oplus = top.put_in_vertex(1, TexMobject("\\oplus"))
        oplus.highlight(BLUE)
        dot = top.put_in_vertex(2, Dot())
        eight = top.put_on_vertex(2, TexMobject("8"))

        self.add(top)
        self.play(ShowCreation(eight))
        for mob in dot, oplus, times:
            self.play(ShowCreation(mob))
            self.dither()

        top.add(eight)
        top.add(times, oplus, dot)
        top1, top2, top3 = tops = [
            top.copy() for i in range(3)
        ]
        big_oplus = TexMobject("\\oplus").scale(2).highlight(BLUE)
        equals = TexMobject("=")
        equation = VMobject(
            top1, big_oplus, top2, equals, top3
        )
        equation.arrange_submobjects()
        top3.shift(0.5*RIGHT)
        x, y, xy = [
            t.put_on_vertex(0, s)
            for t, s in zip(tops, ["x", "y", "xy"])
        ]
        old_style_eq = TexMobject(
            "\\dfrac{1}{\\frac{1}{\\log_x(8)} + \\frac{1}{\\log_y(8)}} = \\log_{xy}(8)"
        )
        old_style_eq.to_edge(UP).highlight(RED)

        triple_top_copy = VMobject(*[
            top.copy() for i in range(3)
        ])
        self.clear()
        self.play(
            Transform(triple_top_copy, VMobject(*tops)),
            FadeIn(VMobject(x, y, xy, big_oplus, equals))
        )
        self.remove(triple_top_copy)
        self.add(*tops)
        self.play(Write(old_style_eq))
        self.dither(3)

        syms = VMobject(x, y, xy)
        new_syms = VMobject(*[
            t.put_on_vertex(1, s)
            for t, s in zip(tops, ["x", "y", "x \\oplus y"])
        ])
        new_old_style_eq = TexMobject(
            "\\sqrt[x]{8} \\sqrt[y]{8} = \\sqrt[X]{8}"
        )
        X = new_old_style_eq.split()[-4]
        frac = TexMobject("\\frac{1}{\\frac{1}{x} + \\frac{1}{y}}")
        frac.replace(X)
        frac_lower_right = frac.get_corner(DOWN+RIGHT)
        frac.scale(2)
        frac.shift(frac_lower_right - frac.get_corner(DOWN+RIGHT))
        new_old_style_eq.submobjects[-4] = frac
        new_old_style_eq.to_edge(UP)
        new_old_style_eq.highlight(RED)
        big_times = TexMobject("\\times").highlight(YELLOW)
        big_times.shift(big_oplus.get_center())
        self.play(
            Transform(old_style_eq, new_old_style_eq),
            Transform(syms, new_syms, path_arc = np.pi/2),
            Transform(big_oplus, big_times)
        )
        self.dither(4)
开发者ID:PythonJedi,项目名称:manim,代码行数:76,代码来源:triangle.py


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