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


Python vectorized_mobject.VGroup类代码示例

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


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

示例1: __init__

 def __init__(self, **kwargs):
     digest_config(self, kwargs)
     videos = [VideoIcon() for x in range(self.num_videos)]
     VGroup.__init__(self, *videos, **kwargs)
     self.arrange_submobjects()
     self.scale_to_fit_width(2*SPACE_WIDTH-MED_LARGE_BUFF)
     self.gradient_highlight(*self.gradient_colors)
开发者ID:crclayton,项目名称:manim,代码行数:7,代码来源:objects.py

示例2: __init__

 def __init__(self, mobject, **kwargs):
     VGroup.__init__(self, 
         Line(UP+LEFT, DOWN+RIGHT),
         Line(UP+RIGHT, DOWN+LEFT),
     )
     self.replace(mobject, stretch = True)
     self.set_stroke(self.stroke_color, self.stroke_width)
开发者ID:PythonJedi,项目名称:manim,代码行数:7,代码来源:geometry.py

示例3: PartyHat

class PartyHat(SVGMobject):
    CONFIG = {
        "file_name" : "party_hat",
        "height" : 1.5,
        "pi_creature" : None,
        "stroke_width" : 0,
        "fill_opacity" : 1,
        "propogate_style_to_family" : True,
        "frills_colors" : [MAROON_B, PURPLE],
        "cone_color" : GREEN,
        "dots_colors" : [YELLOW],
    }
    NUM_FRILLS = 7
    NUM_DOTS = 6
    def __init__(self, **kwargs):
        SVGMobject.__init__(self, **kwargs)
        self.scale_to_fit_height(self.height)
        if self.pi_creature is not None:
            self.next_to(self.pi_creature.eyes, UP, buff = 0)

        self.frills = VGroup(*self[:self.NUM_FRILLS])
        self.cone = self[self.NUM_FRILLS]
        self.dots = VGroup(*self[self.NUM_FRILLS+1:])

        self.frills.gradient_highlight(*self.frills_colors)
        self.cone.highlight(self.cone_color)
        self.dots.gradient_highlight(*self.dots_colors)
开发者ID:crclayton,项目名称:manim,代码行数:27,代码来源:objects.py

示例4: __init__

 def __init__(self, integer, **kwargs):
     num_str = str(integer)
     VGroup.__init__(self, *map(TexMobject, num_str), **kwargs)
     self.arrange_submobjects(
         RIGHT, buff = self.digit_buff, aligned_edge = DOWN
     )
     if num_str[0] == "-":
         self[0].next_to(self[1], LEFT, buff = SMALL_BUFF)
开发者ID:PythonJedi,项目名称:manim,代码行数:8,代码来源:numerals.py

示例5: __init__

 def __init__(self, **kwargs):
     possible_values = map(str, range(1, 11)) + ["J", "Q", "K"]
     possible_suits = ["hearts", "diamonds", "spades", "clubs"]
     VGroup.__init__(self, *[
         PlayingCard(value = value, suit = suit, **kwargs)
         for value in possible_values
         for suit in possible_suits
     ])
开发者ID:PythonJedi,项目名称:manim,代码行数:8,代码来源:probability.py

示例6: name_parts

 def name_parts(self):
     self.mouth = self.submobjects[MOUTH_INDEX]
     self.body = self.submobjects[BODY_INDEX]
     self.pupils = VGroup(*[
         self.submobjects[LEFT_PUPIL_INDEX],
         self.submobjects[RIGHT_PUPIL_INDEX]
     ])
     self.eyes = VGroup(*[
         self.submobjects[LEFT_EYE_INDEX],
         self.submobjects[RIGHT_EYE_INDEX]
     ])
     self.parts_named = True
开发者ID:PythonJedi,项目名称:manim,代码行数:12,代码来源:characters.py

示例7: arrange_subparts

 def arrange_subparts(self, *subparts):
     for i, piece in enumerate(subparts):
         piece.rotate(i*np.pi/12)
     p1, p2, p3, p4, p5, p6, p7 = subparts
     center_row = VGroup(p1, p4, p7)
     center_row.arrange_submobjects(RIGHT, buff = 0)
     for p in p2, p3, p5, p6:
         p.scale_to_fit_width(p1.get_width())
     p2.move_to(p1.get_top(), DOWN+LEFT)
     p3.move_to(p1.get_bottom(), UP+LEFT)
     p5.move_to(p4.get_top(), DOWN+LEFT)
     p6.move_to(p4.get_bottom(), UP+LEFT)
开发者ID:PythonJedi,项目名称:manim,代码行数:12,代码来源:fractals.py

示例8: generate_points

    def generate_points(self):
        body = Cube(side_length = 1)
        for dim, scale_factor in enumerate(self.body_dimensions):
            body.stretch(scale_factor, dim = dim)
        body.scale_to_fit_width(self.width)
        body.set_fill(self.shaded_body_color, opacity = 1)
        body.sort_submobjects(lambda p : p[2])
        body[-1].set_fill(self.body_color)
        keyboard = VGroup(*[
            VGroup(*[
                Square(**self.key_color_kwargs)
                for x in range(12-y%2)
            ]).arrange_submobjects(RIGHT, buff = SMALL_BUFF)
            for y in range(4)
        ]).arrange_submobjects(DOWN, buff = MED_SMALL_BUFF)
        keyboard.stretch_to_fit_width(
            self.keyboard_width_to_body_width*body.get_width(),
        )
        keyboard.stretch_to_fit_height(
            self.keyboard_height_to_body_height*body.get_height(),
        )
        keyboard.next_to(body, OUT, buff = 0.1*SMALL_BUFF)
        keyboard.shift(MED_SMALL_BUFF*UP)
        body.add(keyboard)

        screen_plate = body.copy()
        screen_plate.stretch(self.screen_thickness/self.body_dimensions[2], dim = 2)
        screen = Rectangle(
            stroke_width = 0,
            fill_color = BLACK,
            fill_opacity = 1,
        )
        screen.replace(screen_plate, stretch = True)
        screen.scale_in_place(self.screen_width_to_screen_plate_width)
        screen.next_to(screen_plate, OUT, buff = 0.1*SMALL_BUFF)
        screen_plate.add(screen)
        screen_plate.next_to(body, UP, buff = 0)
        screen_plate.rotate(
            self.open_angle, RIGHT, 
            about_point = screen_plate.get_bottom()
        )
        self.screen_plate = screen_plate
        self.screen = screen

        axis = Line(
            body.get_corner(UP+LEFT+OUT),
            body.get_corner(UP+RIGHT+OUT),
            color = BLACK,
            stroke_width = 2
        )
        self.axis = axis

        self.add(body, screen_plate, axis)
        self.rotate(5*np.pi/12, LEFT)
        self.rotate(np.pi/6, DOWN)
开发者ID:crclayton,项目名称:manim,代码行数:55,代码来源:objects.py

示例9: get_number_mob

 def get_number_mob(self, num):
     result = VGroup()
     place = 0
     max_place = self.max_place
     while place < max_place:
         digit = TexMobject(str(self.get_place_num(num, place)))
         if place >= len(self.digit_place_colors):
             self.digit_place_colors += self.digit_place_colors
         digit.highlight(self.digit_place_colors[place])
         digit.scale(self.num_scale_factor)
         digit.next_to(result, LEFT, buff = SMALL_BUFF, aligned_edge = DOWN)
         result.add(digit)
         place += 1
     return result
开发者ID:PythonJedi,项目名称:manim,代码行数:14,代码来源:counting.py

示例10: get_number_mobjects

 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,代码行数:14,代码来源:number_line.py

示例11: get_dot_template

 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,代码行数:15,代码来源:counting.py

示例12: get_division_along_dimension

    def get_division_along_dimension(self, p_list, dim, colors, vect):
        p_list = self.complete_p_list(p_list)
        colors = color_gradient(colors, len(p_list))

        last_point = self.full_space.get_edge_center(-vect)
        parts = VGroup()
        for factor, color in zip(p_list, colors):
            part = SampleSpace()
            part.set_fill(color, 1)
            part.replace(self.full_space, stretch = True)
            part.stretch(factor, dim)
            part.move_to(last_point, -vect)
            last_point = part.get_edge_center(vect)
            parts.add(part)
        return parts
开发者ID:PythonJedi,项目名称:manim,代码行数:15,代码来源:probability.py

示例13: get_order_n_self

    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,代码行数:15,代码来源:fractals.py

示例14: setup

    def setup(self):
        self.dots = VGroup()
        self.number = 0        
        self.max_place = 0
        self.number_mob = VGroup(TexMobject(str(self.number)))
        self.number_mob.scale(self.num_scale_factor)
        self.number_mob.shift(self.num_start_location)

        self.dot_templates = []
        self.dot_template_iterators = []
        self.curr_configurations = []

        self.arrows = VGroup()

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

示例15: get_axis_labels

 def get_axis_labels(self, x_label = "x", y_label = "y"):
     x_axis, y_axis = self.get_axes().split()
     quads = [
         (x_axis, x_label, UP, RIGHT),
         (y_axis, y_label, RIGHT, UP),
     ]
     labels = VGroup()
     for axis, tex, vect, edge in quads:
         label = TexMobject(tex)
         label.add_background_rectangle()
         label.next_to(axis, vect)
         label.to_edge(edge)
         labels.add(label)
     self.axis_labels = labels
     return labels
开发者ID:PythonJedi,项目名称:manim,代码行数:15,代码来源:number_line.py


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