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


Python TexMobject.scale_to_fit_height方法代码示例

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


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

示例1: generate_points

# 需要导入模块: from mobject.tex_mobject import TexMobject [as 别名]
# 或者: from mobject.tex_mobject.TexMobject import scale_to_fit_height [as 别名]
    def generate_points(self):
        start_angle = np.pi/2 + self.arc_angle/2
        end_angle = np.pi/2 - self.arc_angle/2
        self.add(Arc(
            start_angle = start_angle,
            angle = -self.arc_angle
        ))
        tick_angle_range = np.linspace(start_angle, end_angle, self.num_ticks)
        for index, angle in enumerate(tick_angle_range):
            vect = rotate_vector(RIGHT, angle)
            tick = Line((1-self.tick_length)*vect, vect)
            label = TexMobject(str(10*index))
            label.scale_to_fit_height(self.tick_length)
            label.shift((1+self.tick_length)*vect)
            self.add(tick, label)

        needle = Polygon(
            LEFT, UP, RIGHT,
            stroke_width = 0,
            fill_opacity = 1,
            fill_color = self.needle_color
        )
        needle.stretch_to_fit_width(self.needle_width)
        needle.stretch_to_fit_height(self.needle_height)
        needle.rotate(start_angle - np.pi/2)
        self.add(needle)
        self.needle = needle

        self.center_offset = self.get_center()
开发者ID:crclayton,项目名称:manim,代码行数:31,代码来源:objects.py

示例2: move_matrix_parentheses

# 需要导入模块: from mobject.tex_mobject import TexMobject [as 别名]
# 或者: from mobject.tex_mobject.TexMobject import scale_to_fit_height [as 别名]
    def move_matrix_parentheses(self, morty, matrices):
        m1, m2, m3 = matrices
        parens = TexMobject(["(", ")"])
        parens.scale_to_fit_height(1.2*m1.get_height())
        lp, rp = parens.split()
        state1 = VMobject(
            VectorizedPoint(m1.get_left()),
            m1, m2, 
            VectorizedPoint(m2.get_right()),
            m3
        )
        state2 = VMobject(*[
            m.copy() for m in lp, m1, m2, rp, m3
        ])
        state3 = VMobject(*[
            m.copy() for m in m1, lp, m2, m3, rp
        ])
        for state in state2, state3:
            state.arrange_submobjects(RIGHT, buff = 0.1)
        m1, lp, m2, m3, rp = state3.split()
        state3 = VMobject(lp, m1, m2, rp, m3)

        self.play(morty.change_mode, "angry")
        for state in state2, state3:
            self.play(Transform(state1, state))
            self.dither()
        self.play(morty.change_mode, "confused")
        self.dither()
开发者ID:PythonJedi,项目名称:manim,代码行数:30,代码来源:chapter4.py

示例3: construct

# 需要导入模块: from mobject.tex_mobject import TexMobject [as 别名]
# 或者: from mobject.tex_mobject.TexMobject import scale_to_fit_height [as 别名]
    def construct(self):
        pause = TexMobject("=").rotate(np.pi/2)
        pause.stretch(0.5, 1)
        pause.scale_to_fit_height(1.5)
        bubble = ThoughtBubble().scale_to_fit_height(2)
        pause.shift(LEFT)
        bubble.next_to(pause, RIGHT, buff = 1)

        self.play(FadeIn(pause))
        self.play(ShowCreation(bubble))
        self.dither()
开发者ID:PythonJedi,项目名称:manim,代码行数:13,代码来源:chapter0.py

示例4: get_theta_group

# 需要导入模块: from mobject.tex_mobject import TexMobject [as 别名]
# 或者: from mobject.tex_mobject.TexMobject import scale_to_fit_height [as 别名]
 def get_theta_group(self):
     arc = Arc(
         self.theta_value, 
         radius = self.arc_radius,
         color = self.theta_color,
     )
     theta = TexMobject("\\theta")
     theta.shift(1.5*arc.point_from_proportion(0.5))
     theta.highlight(self.theta_color)
     theta.scale_to_fit_height(self.theta_height)
     line = Line(ORIGIN, self.get_circle_point())
     dot = Dot(line.get_end(), radius = 0.05)
     return VGroup(line, arc, theta, dot)
开发者ID:PythonJedi,项目名称:manim,代码行数:15,代码来源:tattoo.py

示例5: get_number_mobjects

# 需要导入模块: from mobject.tex_mobject import TexMobject [as 别名]
# 或者: from mobject.tex_mobject.TexMobject import scale_to_fit_height [as 别名]
 def get_number_mobjects(self, *numbers, **kwargs):
     #TODO, handle decimals
     if len(numbers) == 0:
         numbers = self.default_numbers_to_display()
     result = VGroup()
     for number in numbers:
         mob = TexMobject(str(int(number)))
         mob.scale_to_fit_height(3*self.tick_size)
         mob.shift(
             self.number_to_point(number),
             self.get_vertical_number_offset(**kwargs)
         )
         result.add(mob)
     return result
开发者ID:PythonJedi,项目名称:manim,代码行数:16,代码来源:number_line.py

示例6: construct

# 需要导入模块: from mobject.tex_mobject import TexMobject [as 别名]
# 或者: from mobject.tex_mobject.TexMobject import scale_to_fit_height [as 别名]
    def construct(self):
        self.setup_axes()
        self.force_skipping()
        self.draw_f()
        self.remove(self.graph_label)
        self.graph.set_stroke(GREEN, width = 8)

        tex = TexMobject("{d^n f", "\\over", "dx^n}")
        tex.highlight_by_tex("d^n", YELLOW)
        tex.highlight_by_tex("dx", BLUE)
        tex.scale_to_fit_height(4)
        tex.to_edge(UP)

        self.add(tex)
开发者ID:PythonJedi,项目名称:manim,代码行数:16,代码来源:footnote.py

示例7: scale_vector

# 需要导入模块: from mobject.tex_mobject import TexMobject [as 别名]
# 或者: from mobject.tex_mobject.TexMobject import scale_to_fit_height [as 别名]
    def scale_vector(self, v, factor, v_label, 
                     v_name = "v", factor_tex = None):
        starting_mobjects = list(self.mobjects)

        if factor_tex is None:
            factor_tex = str(factor)
        scaled_vector = self.add_vector(
            factor*v.get_end(), animate = False
        )
        self.remove(scaled_vector)
        label_tex = "%s\\vec{\\textbf{%s}}"%(factor_tex, v_name)
        label = self.label_vector(
            scaled_vector, label_tex, animate = False,
            add_to_vector = False
        )
        self.remove(label)
        factor_mob = TexMobject(factor_tex)
        if factor_mob.get_height() > 1:
            factor_mob.scale_to_fit_height(0.9)
        if factor_mob.get_width() > 1:
            factor_mob.scale_to_fit_width(0.9)
        factor_mob.shift(1.5*RIGHT+2.5*UP)

        num_factor_parts = len(factor_mob.split())
        factor_mob_parts_in_label = label.split()[:num_factor_parts]
        label_remainder_parts = label.split()[num_factor_parts:]
        factor_in_label = VMobject(*factor_mob_parts_in_label)
        label_remainder = VMobject(*label_remainder_parts)


        self.play(Write(factor_mob, run_time = 1))
        self.dither()
        self.play(
            ApplyMethod(v.copy().highlight, DARK_GREY),
            ApplyMethod(v_label.copy().highlight, DARK_GREY),
            Transform(factor_mob, factor_in_label),
            Transform(v.copy(), scaled_vector),
            Transform(v_label.copy(), label_remainder),
        )
        self.dither(2)

        self.clear()
        self.add(*starting_mobjects)
开发者ID:namkam5,项目名称:manim,代码行数:45,代码来源:chapter1.py

示例8: get_coordinate_labels

# 需要导入模块: from mobject.tex_mobject import TexMobject [as 别名]
# 或者: from mobject.tex_mobject.TexMobject import scale_to_fit_height [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

示例9: get_coordinate_labels

# 需要导入模块: from mobject.tex_mobject import TexMobject [as 别名]
# 或者: from mobject.tex_mobject.TexMobject import scale_to_fit_height [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:
             if val == 0:
                 continue
             num_pair[index] = val
             point = self.coords_to_point(*num_pair)
             num = TexMobject(str(val))
             num.add_background_rectangle()
             num.scale_to_fit_height(
                 self.written_coordinate_height
             )
             vect = DOWN if index == 0 else LEFT
             num.next_to(point, vect, buff = SMALL_BUFF)
             result.append(num)
     return result
开发者ID:PythonJedi,项目名称:manim,代码行数:23,代码来源:number_line.py

示例10: construct

# 需要导入模块: from mobject.tex_mobject import TexMobject [as 别名]
# 或者: from mobject.tex_mobject.TexMobject import scale_to_fit_height [as 别名]
 def construct(self):
     z = TexMobject("z").highlight(Z_COLOR)
     z.scale_to_fit_height(4)
     self.play(Write(z, run_time = 2))
     self.dither(3)
开发者ID:namkam5,项目名称:manim,代码行数:7,代码来源:chapter1.py


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