Exemplo n.º 1
0
    def construct(self):
        digest_config(self, {})
        ## Usually shouldn't need this...
        self.frame_duration = self.CONFIG["frame_duration"]
        ##
        digest_config(self, {})
        circle = Circle(density=self.circle_density, color=self.circle_blue)
        circle.repeat(self.circle_repeats)
        circle.scale(self.radius)
        sphere = Sphere(density=self.sphere_density, color=self.sphere_blue)
        sphere.scale(self.radius)
        sphere.rotate(-np.pi / 7, [1, 0, 0])
        sphere.rotate(-np.pi / 7)
        iris = Mobject()
        iris.interpolate(circle, sphere, self.interpolation_factor)
        for mob, color in [(iris, self.sphere_brown),
                           (circle, self.circle_brown)]:
            mob.highlight(color, lambda (x, y, z): x < 0 and y > 0)
            mob.highlight(
                "black",
                lambda point: np.linalg.norm(point) < \
                              self.inner_radius_ratio*self.radius
            )
        self.name_mob = TextMobject("3Blue1Brown").center()
        self.name_mob.highlight("grey")
        self.name_mob.shift(2 * DOWN)

        self.play(Transform(circle, iris, run_time=self.run_time))
        self.frames = drag_pixels(self.frames)
        self.save_image(IMAGE_DIR)
        self.logo = MobjectFromPixelArray(self.frames[-1])
        self.add(self.name_mob)
        self.dither()
Exemplo n.º 2
0
 def generate_points(self):
     complex_power = 0.9
     radius = self.initial_width/2
     circle = Circle(radius = radius)
     circle.scale(1.0/radius)
     circle.apply_complex_function(lambda z : z**complex_power)
     circle.scale(radius)
     boundary_point_as_complex = radius*complex(-1)**complex_power
     boundary_points = [
         [
             boundary_point_as_complex.real,
             unit*boundary_point_as_complex.imag,
             0
         ]
         for unit in -1, 1
     ]
     tip = radius*(1.5*LEFT+UP)
     self.little_line = Line(boundary_points[0], tip)
     self.circle = circle
     self.add(
         circle,
         self.little_line,
         Line(boundary_points[1], tip)
     )
     self.highlight("white")
     self.rotate(np.pi/2)
     self.stretch_to_fit_height(self.initial_height)
Exemplo n.º 3
0
    def construct(self):
        digest_config(self, {})
        ## Usually shouldn't need this...
        self.frame_duration = self.DEFAULT_CONFIG["frame_duration"]
        ##
        digest_config(self, {})
        circle = Circle(
            density = self.circle_density, 
            color   = self.circle_blue
        )
        circle.repeat(self.circle_repeats)
        circle.scale(self.radius)
        sphere = Sphere(
            density = self.sphere_density, 
            color   = self.sphere_blue
        )
        sphere.scale(self.radius)
        sphere.rotate(-np.pi / 7, [1, 0, 0])
        sphere.rotate(-np.pi / 7)
        iris = Mobject()
        iris.interpolate(
            circle, sphere,
            self.interpolation_factor
        )
        for mob, color in [(iris, self.sphere_brown), (circle, self.circle_brown)]:
            mob.highlight(color, lambda (x, y, z) : x < 0 and y > 0)
            mob.highlight(
                "black", 
                lambda point: np.linalg.norm(point) < \
                              self.inner_radius_ratio*self.radius
            )
        name = TextMobject("3Blue1Brown").center()
        name.highlight("grey")
        name.shift(2*DOWN)

        self.play(Transform(
            circle, iris, 
            run_time = self.run_time
        ))
        self.frames = drag_pixels(self.frames)
        self.save_image(IMAGE_DIR)
        self.show_frame()
        self.add(name)
        self.dither()
        print "Dragging pixels..."
Exemplo n.º 4
0
 def generate_points(self):
     complex_power = 0.9
     radius = self.initial_width / 2
     circle = Circle(radius=radius)
     circle.scale(1.0 / radius)
     circle.apply_complex_function(lambda z: z**complex_power)
     circle.scale(radius)
     boundary_point_as_complex = radius * complex(-1)**complex_power
     boundary_points = [[
         boundary_point_as_complex.real,
         unit * boundary_point_as_complex.imag, 0
     ] for unit in -1, 1]
     tip = radius * (1.5 * LEFT + UP)
     self.little_line = Line(boundary_points[0], tip)
     self.circle = circle
     self.add(circle, self.little_line, Line(boundary_points[1], tip))
     self.highlight("white")
     self.rotate(np.pi / 2)
     self.stretch_to_fit_height(self.initial_height)