當前位置: 首頁>>代碼示例>>Python>>正文


Python VGroup.scale_to_fit_height方法代碼示例

本文整理匯總了Python中mobject.vectorized_mobject.VGroup.scale_to_fit_height方法的典型用法代碼示例。如果您正苦於以下問題:Python VGroup.scale_to_fit_height方法的具體用法?Python VGroup.scale_to_fit_height怎麽用?Python VGroup.scale_to_fit_height使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mobject.vectorized_mobject.VGroup的用法示例。


在下文中一共展示了VGroup.scale_to_fit_height方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_dot_template

# 需要導入模塊: from mobject.vectorized_mobject import VGroup [as 別名]
# 或者: from mobject.vectorized_mobject.VGroup import scale_to_fit_height [as 別名]
 def get_dot_template(self, place):
     #This should be replaced for non-base-10 counting scenes
     down_right = (0.5)*RIGHT + (np.sqrt(3)/2)*DOWN
     dots = VGroup(*[
         Dot(
             point, 
             radius = 0.25,
             fill_opacity = 0,
             stroke_width = 2,
             stroke_color = WHITE,
         )
         for point in self.get_template_configuration(place)
     ])
     dots.scale_to_fit_height(self.dot_configuration_height)
     return dots
開發者ID:PythonJedi,項目名稱:manim,代碼行數:17,代碼來源:counting.py

示例2: get_eyes

# 需要導入模塊: from mobject.vectorized_mobject import VGroup [as 別名]
# 或者: from mobject.vectorized_mobject.VGroup import scale_to_fit_height [as 別名]
    def get_eyes(self, mode = None, thing_to_look_at = None):
        mode = mode or self.mode
        if thing_to_look_at is None:
            thing_to_look_at = self.thing_looked_at

        pi = Randolph(mode = mode)
        eyes = VGroup(pi.eyes, pi.pupils)
        eyes.scale_to_fit_height(self.height)
        if self.submobjects:
            eyes.move_to(self, DOWN)
        else:
            eyes.move_to(self.mobject.get_top(), DOWN)
        if thing_to_look_at is not None:
            pi.look_at(thing_to_look_at)
        return eyes
開發者ID:PythonJedi,項目名稱:manim,代碼行數:17,代碼來源:characters.py

示例3: get_order_n_self

# 需要導入模塊: from mobject.vectorized_mobject import VGroup [as 別名]
# 或者: from mobject.vectorized_mobject.VGroup import scale_to_fit_height [as 別名]
    def get_order_n_self(self, order):
        if order == 0:
            result = self.get_seed_shape()
        else:
            lower_order = self.get_order_n_self(order - 1)
            subparts = [
                lower_order.copy()
                for x in range(self.num_subparts)
            ]
            self.arrange_subparts(*subparts)
            result = VGroup(*subparts)

        result.scale_to_fit_height(self.height)
        result.center()
        return result
開發者ID:PythonJedi,項目名稱:manim,代碼行數:17,代碼來源:fractals.py

示例4: get_secant_slope_group

# 需要導入模塊: from mobject.vectorized_mobject import VGroup [as 別名]
# 或者: from mobject.vectorized_mobject.VGroup import scale_to_fit_height [as 別名]
    def get_secant_slope_group(
        self, 
        x, graph, 
        dx = None,
        dx_line_color = None,
        df_line_color = None,
        dx_label = None,
        df_label = None,
        include_secant_line = True,
        secant_line_color = None,
        secant_line_length = 10,
        ):
        """
        Resulting group is of the form VGroup(
            dx_line, 
            df_line,
            dx_label, (if applicable)
            df_label, (if applicable)
            secant_line, (if applicable)
        )
        with attributes of those names.
        """
        kwargs = locals()
        kwargs.pop("self")
        group = VGroup()
        group.kwargs = kwargs

        dx = dx or float(self.x_max - self.x_min)/10
        dx_line_color = dx_line_color or self.default_input_color
        df_line_color = df_line_color or graph.get_color()

        p1 = self.input_to_graph_point(x, graph)
        p2 = self.input_to_graph_point(x+dx, graph)
        interim_point = p2[0]*RIGHT + p1[1]*UP

        group.dx_line = Line(
            p1, interim_point,
            color = dx_line_color
        )
        group.df_line = Line(
            interim_point, p2,
            color = df_line_color
        )
        group.add(group.dx_line, group.df_line)

        labels = VGroup()
        if dx_label is not None:
            group.dx_label = TexMobject(dx_label)
            labels.add(group.dx_label)
            group.add(group.dx_label)
        if df_label is not None:
            group.df_label = TexMobject(df_label)
            labels.add(group.df_label)
            group.add(group.df_label)

        if len(labels) > 0:
            max_width = 0.8*group.dx_line.get_width()
            max_height = 0.8*group.df_line.get_height()            
            if labels.get_width() > max_width:
                labels.scale_to_fit_width(max_width)
            if labels.get_height() > max_height:
                labels.scale_to_fit_height(max_height)

        if dx_label is not None:
            group.dx_label.next_to(
                group.dx_line, 
                np.sign(dx)*DOWN,
                buff = group.dx_label.get_height()/2
            )
            group.dx_label.highlight(group.dx_line.get_color())

        if df_label is not None:
            group.df_label.next_to(
                group.df_line, 
                np.sign(dx)*RIGHT,
                buff = group.df_label.get_height()/2
            )
            group.df_label.highlight(group.df_line.get_color())

        if include_secant_line:
            secant_line_color = secant_line_color or self.default_derivative_color
            group.secant_line = Line(p1, p2, color = secant_line_color)
            group.secant_line.scale_in_place(
                secant_line_length/group.secant_line.get_length()
            )
            group.add(group.secant_line)

        return group
開發者ID:crclayton,項目名稱:manim,代碼行數:90,代碼來源:graph_scene.py


注:本文中的mobject.vectorized_mobject.VGroup.scale_to_fit_height方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。