コード例 #1
0
ファイル: section3.py プロジェクト: zhujianing/manim
 def get_triangles(self):
     triangle = Polygon(LEFT / np.sqrt(3),
                        UP,
                        RIGHT / np.sqrt(3),
                        color=GREEN)
     triangles = Mobject(triangle.copy().scale(0.5).shift(LEFT), triangle,
                         triangle.copy().scale(0.3).shift(0.5 * UP + RIGHT))
     triangles.center()
     return triangles
コード例 #2
0
ファイル: objects.py プロジェクト: sptj/manim
    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()
コード例 #3
0
ファイル: section3.py プロジェクト: Rubixdarcy/manim
 def get_triangles(self):
     triangle = Polygon(
         LEFT/np.sqrt(3),
         UP,
         RIGHT/np.sqrt(3),
         color = GREEN
     )
     triangles = Mobject(
         triangle.copy().scale(0.5).shift(LEFT),
         triangle,
         triangle.copy().scale(0.3).shift(0.5*UP+RIGHT)
     )
     triangles.center()
     return triangles
コード例 #4
0
ファイル: objects.py プロジェクト: crclayton/manim
    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()
コード例 #5
0
 def get_seed_shape(self):
     return Polygon(
         RIGHT,
         np.sqrt(3) * UP,
         LEFT,
     )