Exemplo n.º 1
0
    def __init__(self, start_time="Epoca antigua", *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.timeline = presets.TimeLine(**self.timeline_config)
        self.timeline.next_to(self.points["reference"], DOWN, buff=0)

        self.timeline.preload_for_scene(target_time=start_time, scene=self)

        self.cur_time = self.timeline.get_current_time()
Exemplo n.º 2
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.timeline = presets.TimeLine(**configs.timeline_config)
        self.timeline.next_to(REFERENCE_POINT, DOWN, buff=0)
        self.timeline.preload_for_scene(
            target_time="Imperio Romano",
            scene=self  # pass the scene as parameter
        )

        current_time = self.timeline.get_current_time()

        self.wait()  # this fix bug of miss position text due to updaters

        title_config = {
            "stroke_width": 1,
            "background_stroke_width": 3,
            "background_stroke_color": BLACK,
            "color": PURPLE,
        }
        paragraph_config = {
            "stroke_width": 1,
            "background_stroke_width": 3,
            "background_stroke_color": BLACK,
            "line_length": 35,
            "interline_scape": 0.3,
            "color": BEIGE,
        }
        self.previous = {
            "image":
            ImageMobject(filename_or_array=presets.image_path(
                ".\\history\\13_romans_2.jpg")),
            "title":
            Tex("Imperio romano", **title_config),
            "list":
            BulletedList(
                "Realizaban censos cada 5 años",
                "sus funcionarios recopilaban los datos \\\\sobre nacimiento, defunciones y \\\\matrimonios",
                "Recuentos de ganado, terreno y \\\\riquezas obtenidas en las tierras \\\\conquistadas",
                dot_scale_factor=2,
                **paragraph_config),
        }

        for line in self.previous["list"]:
            line[0].set_color(SKY_BLUE).scale(1.05)

        self.previous["list"].scale(0.6).next_to(
            current_time, RIGHT).align_on_border(RIGHT, 1).shift(DOWN * 0.5)
        self.previous["image"].scale(0.9).next_to(self.previous["list"],
                                                  LEFT,
                                                  buff=0.4)
        self.previous["title"].scale(0.5).next_to(self.previous["image"],
                                                  UP,
                                                  buff=0.3)

        self.add(*self.previous.values())
Exemplo n.º 3
0
    def construct(self):

        frame_height = self.camera.frame_height
        frame_width = self.camera.frame_width

        line_alignment = "left"
        line_length = 40
        paragraph_width = frame_width / 2.2

        timeline = presets.TimeLine(**configs.timeline_config)
        timeline.next_to(REFERENCE_POINT, DOWN, buff=0)
        timeline.preload_for_scene(
            target_time="2000",
            scene=self  # pass the scene as parameter
        )

        self.play(timeline.next_time_scroll())

        text = "Se desarrollaron indicadores de bienestar subjetivo y sentimientos socioeconómicos sobre las percepciones de hogares y empresas con el fin de medir el impacto del COVID-19"

        paragraph = presets.PTex(text=text,
                                 alignment=line_alignment,
                                 line_length=line_length,
                                 interline_space=0.1,
                                 **configs.text_config)

        paragraph.width = paragraph_width
        paragraph.align_on_border(LEFT, buff=2.5)

        remaining_space = (Point().align_on_border(
            RIGHT, buff=0).get_center()) - (paragraph.get_corner(RIGHT))

        # Imagen

        stats_image = ImageMobject(
            filename_or_array=presets.image_path("danecovid.jpg"))
        stats_image.scale(0.5)
        # stats_image.scale_to_fit_width(remaining_space - 1)
        # stats_image.heigh = frame

        stats_image.next_to(paragraph, RIGHT, buff=0.7)

        self.play(Write(paragraph), FadeIn(stats_image), run_time=3)

        # self.play(Write(paragraph), DrawBorderThenFill(coins_svg))
        # self.play(DrawBorderThenFill(pickaxe_svg), run_time=2)
        # # self.play(Write(paragraph), Create(graph))
        self.wait(2)

        self.play(
            FadeOutAndShift(paragraph, UP_SCREEN),
            FadeOutAndShift(stats_image, UP_SCREEN),
        )

        self.wait(2)
Exemplo n.º 4
0
    def construct(self):

        frame_height = self.camera.frame_height
        frame_width = self.camera.frame_width

        timeline = presets.TimeLine(**configs.timeline_config)
        timeline.next_to(REFERENCE_POINT, DOWN, buff=0)
        timeline.preload_for_scene(
            target_time="1066",
            scene=self  # pass the scene as parameter
        )

        self.play(timeline.next_time_scroll())

        text = "En este siglo se realizó el primer censo estadístico moderno, gracias al trabajo de John Graunt en la inferencia y teoría estadística, se pudo predecir la cantidad de personas que morirían por diversas enfermedades, se realizó la primera tabla de probabilidades por género y edades."

        paragraph = presets.text_to_paragraph(text,
                                              line_length=30,
                                              color=BEIGE)
        paragraph.height = frame_height / 3
        paragraph.align_on_border(LEFT, buff=3)

        modelo_image = ImageMobject(
            filename_or_array=presets.image_path("modelo.jpg"))
        modelo_image.width = frame_width / 3.5
        modelo_image.next_to(paragraph, RIGHT, buff=0.5)

        self.graph_origin = (paragraph.get_corner(RIGHT) +
                             RIGHT * frame_width * 0.5) / 2
        self.x_axis_width = 5
        self.x_min = -2.5
        self.x_max = 2.5
        self.y_axis_height = 3
        self.y_max = 3
        self.setup_axes()

        def normal_dist(x):

            return math.exp(-(x**2) / 2) / math.sqrt(2 * math.pi)

        graph = self.get_graph(normal_dist, x_min=-2, x_max=2)

        # self.play(Write(paragraph), FadeIn(modelo_image))
        self.play(Write(paragraph), Create(graph))
        self.wait(2)

        self.play(
            FadeOutAndShift(paragraph, UP_SCREEN),
            FadeOutAndShift(graph, UP_SCREEN),
            FadeOutAndShift(self.axes, UP_SCREEN),
        )
Exemplo n.º 5
0
    def construct(self):

        frame_height = self.camera.frame_height
        frame_width = self.camera.frame_width

        timeline = presets.TimeLine(**configs.timeline_config)
        timeline.next_to(REFERENCE_POINT, DOWN, buff=0)
        timeline.preload_for_scene(
            target_time="Siglo XVI",
            scene=self  # pass the scene as parameter
        )

        # self.play(timeline.next_time_scroll())

        text = "La necesidad de usar la estadística en el 1500 surgió con la explotación minera y la necesidad de llevar un control sobre la moneda, el pago de tributos, y la administración de suministros enviados a las tropas."

        paragraph = presets.text_to_paragraph(text,
                                              line_length=30,
                                              color=BEIGE)
        paragraph.height = frame_height / 4
        paragraph.align_on_border(LEFT, buff=3)

        coins_svg = SVGMobject(file_name="./assets/svg/coins")
        coins_svg.width = 5
        coins_svg.next_to(paragraph, RIGHT, buff=0.5)

        pickaxe_svg = SVGMobject(file_name="./assets/svg/pickaxe")
        pickaxe_svg.width = 2
        # pickaxe_svg.set_color(WHITE)
        pickaxe_svg.move_to(coins_svg.get_center_of_mass())
        pickaxe_svg.shift(LEFT * 0.4)

        # self.graph_origin = (paragraph.get_corner(RIGHT) + RIGHT*frame_width*0.5) / 2
        # self.x_axis_width = 5
        # self.x_min = -2.5
        # self.x_max = 2.5
        # self.y_axis_height = 3
        # self.y_max = 3
        # self.setup_axes()

        self.play(Write(paragraph), DrawBorderThenFill(coins_svg))
        self.play(DrawBorderThenFill(pickaxe_svg), run_time=2)
        # self.play(Write(paragraph), Create(graph))
        self.wait(2)

        self.play(
            FadeOutAndShift(paragraph, UP_SCREEN),
            FadeOutAndShift(coins_svg, UP_SCREEN),
            FadeOutAndShift(pickaxe_svg, UP_SCREEN),
        )
Exemplo n.º 6
0
    def construct(self):

        # time line

        timeline = presets.TimeLine(**self.timeline_config)
        timeline.next_to(self.points["reference"], DOWN, buff=0)
        timeline.times[0].shift(RIGHT * 0.08)

        header = Tex("Historia de la ", "Estadística",
                     **self.main_title_config).scale(1.2)

        header.align_on_border(UP, buff=0.8)

        etimology = VGroup(
            Tex("Statis", "t", "icus",
                **self.text_config).set_color(self.main_title_config["color"]),
            Tex("Status", **self.text_config).set_color(DARK_SKY_BLUE),
            Tex("icus", **self.text_config).set_color(DARK_SKY_BLUE),
            Tex("(", "estado", ")", **self.text_config).scale(0.8),
            Tex("(relativo a)", **self.text_config).scale(0.8),
            Tex(
                '"Relativo al estado"',
                **self.text_config,
            ).set_color(BEIGE_B),
        )

        diagonal_buff = 0.5
        down_buff = 0.5

        etimology[0].shift(UP * 2)
        etimology[1].next_to(etimology[0], DL, buff=diagonal_buff)
        etimology[2].next_to(etimology[0], DR, buff=diagonal_buff)
        etimology[3].next_to(etimology[1], DOWN, buff=down_buff)
        etimology[4].next_to(etimology[2], DOWN, buff=down_buff)

        brace = Brace(VGroup(etimology[3:5]), direction=DOWN)

        etimology[-1].next_to(brace, DOWN, buff=down_buff)

        # images and text

        manuscript = {
            "image":
            ImageMobject(
                filename_or_array=image_path(".\\history\\1_manuscrito.jpeg")),
            "title":
            Tex("Manuscrito recuperado", **self.text_config),
        }
        emperor = {
            "image":
            ImageMobject(filename_or_array=image_path(
                ".\\history\\2_emperador_chino.jpg")),
            "title":
            Tex("Dinastia china", **self.text_config),
        }
        players = {
            "image":
            ImageMobject(filename_or_array=image_path(
                ".\\history\\3_jugadores_dados.jpg")),
            "title":
            Tex("Nacimiento de las probabilidades", **self.text_config),
        }

        image_space_between = 1.3

        manuscript["image"].scale(1.2).align_on_border(LEFT, buff=1)
        emperor["image"].scale(0.8).next_to(manuscript["image"],
                                            buff=image_space_between)
        players["image"].scale(1.7).next_to(emperor["image"],
                                            buff=image_space_between)

        manuscript["title"].scale(self.scales["title"]).next_to(
            manuscript["image"], UP, buff=self.buffs["title"])
        emperor["title"].scale(self.scales["title"]).next_to(
            emperor["image"], UP, buff=self.buffs["title"])
        players["title"].scale(self.scales["title"]).next_to(
            players["image"], UP, buff=self.buffs["title"])

        # animations

        self.play(Write(header), run_time=2)

        self.play(
            FadeIn(manuscript["image"]),
            FadeIn(emperor["image"]),
            FadeIn(players["image"]),
            AnimationGroup(
                Wait(1),
                AnimationGroup(
                    Write(manuscript["title"]),
                    Write(emperor["title"]),
                    Write(players["title"]),
                    lag_ratio=0,
                ),
                lag_ratio=1,
            ),
            run_time=5,
        )
        self.wait()

        self.play(
            ReplacementTransform(header[1], etimology[0]),
            FadeOut(header[0]),
            FadeOut(manuscript["image"]),
            FadeOut(emperor["image"]),
            FadeOut(players["image"]),
            FadeOut(
                VGroup(
                    manuscript["title"],
                    emperor["title"],
                    players["title"],
                )),
            run_time=2,
        )

        self.play(
            ReplacementTransform(etimology[0][0].copy(), etimology[1]),
            ReplacementTransform(etimology[0][-1].copy(), etimology[2]),
            run_time=2,
        )

        self.play(
            ReplacementTransform(etimology[1].copy(), etimology[3]),
            ReplacementTransform(etimology[2].copy(), etimology[4]),
            run_time=2,
        )

        self.play(
            GrowFromCenter(brace),
            AnimationGroup(Wait(0.5), Write(etimology[-1]), lag_ratio=1),
            run_time=3,
        )

        self.play(
            FadeOut(etimology),
            FadeOut(brace),
            AnimationGroup(Wait(0.5),
                           timeline.create(with_arrow=True, with_time=True),
                           lag_ratio=1),
            run_time=4,
        )

        self.wait()
Exemplo n.º 7
0
    def construct(self):

        frame_height = self.camera.frame_height
        frame_width = self.camera.frame_width

        line_alignment = "left"
        line_length = 40
        paragraph_width = frame_width / 2.2

        timeline = presets.TimeLine(**configs.timeline_config)
        timeline.next_to(REFERENCE_POINT, DOWN, buff=0)
        timeline.preload_for_scene(
            target_time="Siglo XX",
            scene=self  # pass the scene as parameter
        )

        self.play(timeline.next_time_scroll())

        text_points = [
            "Se realiza un censo general de población",
            "El DANE registra los damnificados de la ola invernal 2010-2011 y esto ayudó a orientar proyectos para soportar a dicha población",
            "Se aplicó la encuesta de convivencia y seguridad ciudadana",
            "El DANE oficialmente mide la pobreza monetaria y multidimensional (2011)",
        ]

        bullet_points = VGroup()

        for line in text_points:
            paragraph = presets.PTex(text=line,
                                     alignment=line_alignment,
                                     line_length=line_length,
                                     interline_space=0.1,
                                     **configs.text_config)

            bullet_dot = MathTex(r"\cdot").scale(2)
            bullet_dot.next_to(paragraph.submobjects[0], LEFT, buff=0.3)

            bullet_points.add(VGroup(bullet_dot, paragraph))

        bullet_points.width = paragraph_width

        bullet_points.arrange(DOWN, buff=0.5)

        for prev_index, current in enumerate(bullet_points[1:]):

            current.align_to(bullet_points[prev_index], LEFT, LEFT)

        bullet_points.align_on_border(LEFT, buff=3)
        # bullet_points.shift(DOWN)
        remaining_space = (Point().align_on_border(
            RIGHT, buff=0).get_center()) - (bullet_points.get_corner(RIGHT))
        # remaining_midpoint = (Point().align_on_border(RIGHT, buff=0).get_center()) + (bullet_points.get_corner(RIGHT))/2

        # Imagen

        stats_image = ImageMobject(
            filename_or_array=presets.image_path("censo.jpg"))
        stats_image.scale(0.6)
        # stats_image.scale_to_fit_width(remaining_space - 1)
        # stats_image.heigh = frame

        stats_image.next_to(bullet_points, RIGHT, buff=0.7)

        self.play(Write(bullet_points), FadeIn(stats_image), run_time=3)

        # self.play(Write(paragraph), DrawBorderThenFill(coins_svg))
        # self.play(DrawBorderThenFill(pickaxe_svg), run_time=2)
        # # self.play(Write(paragraph), Create(graph))
        self.wait(2)

        self.play(
            FadeOutAndShift(bullet_points, UP_SCREEN),
            FadeOutAndShift(stats_image, UP_SCREEN),
            # FadeOutAndShift(pickaxe_svg, UP_SCREEN),
        )
Exemplo n.º 8
0
    def construct(self):

        frame_height = self.camera.frame_height
        frame_width = self.camera.frame_width

        timeline = presets.TimeLine(**configs.timeline_config)
        timeline.next_to(REFERENCE_POINT, DOWN, buff=0)
        timeline.preload_for_scene(
            target_time="Siglo XX",
            scene=self  # pass the scene as parameter
        )

        # self.play(timeline.next_time_scroll())

        line_alignment = "left"
        line_length = 40
        paragraph_width = frame_width / 2.2

        text_points = [
            "El BR genera promedios de precios de productos alimenticios",
            "Se mide el costo de vida en las ciudades a través de encuestas",
            "Se crea el departamento nacional de estadística (DANE) y se ofrece la información al público",
            "Se realizó el primer censo nacional agropecuario",
            "Se realizó el censo de industria, comercio y servicios",
            "Se implementa la encuesta nacional de hogares, la de ingresos y gastos, y la de calidad de vida",
        ]

        bullet_points = VGroup()

        for line in text_points:
            paragraph = presets.PTex(text=line,
                                     alignment=line_alignment,
                                     line_length=line_length,
                                     interline_space=0.1,
                                     **configs.text_config)

            bullet_dot = MathTex(r"\cdot").scale(2)
            bullet_dot.next_to(paragraph.submobjects[0], LEFT, buff=0.3)

            bullet_points.add(VGroup(bullet_dot, paragraph))

        bullet_points.width = paragraph_width

        bullet_points.arrange(DOWN, buff=0.5)

        for prev_index, current in enumerate(bullet_points[1:]):

            current.align_to(bullet_points[prev_index], LEFT, LEFT)

        bullet_points.align_on_border(LEFT, buff=3)
        # bullet_points.shift(DOWN)
        remaining_space = (Point().align_on_border(
            RIGHT, buff=0).get_center()) - (bullet_points.get_corner(RIGHT))
        # remaining_midpoint = (Point().align_on_border(RIGHT, buff=0).get_center()) + (bullet_points.get_corner(RIGHT))/2

        # Imagen

        stats_image = ImageMobject(
            filename_or_array=presets.image_path("danelogo.png"))
        stats_image.scale(0.6)
        # stats_image.scale_to_fit_width(remaining_space - 1)
        # stats_image.heigh = frame

        stats_image.next_to(bullet_points, RIGHT, buff=0.7)

        self.play(Write(bullet_points), FadeIn(stats_image), run_time=3)

        # self.play(Write(paragraph), DrawBorderThenFill(coins_svg))
        # self.play(DrawBorderThenFill(pickaxe_svg), run_time=2)
        # # self.play(Write(paragraph), Create(graph))
        self.wait(2)

        self.play(
            FadeOutAndShift(bullet_points, UP_SCREEN),
            FadeOutAndShift(stats_image, UP_SCREEN),
            # FadeOutAndShift(pickaxe_svg, UP_SCREEN),
        )
Exemplo n.º 9
0
    def construct(self):

        frame_height = self.camera.frame_height
        frame_width = self.camera.frame_width

        line_alignment = "left"
        line_length = 40
        paragraph_width = frame_width / 2.2

        timeline = presets.TimeLine(**configs.timeline_config)
        timeline.next_to(REFERENCE_POINT, DOWN, buff=0)
        timeline.preload_for_scene(
            target_time="1800",
            scene=self  # pass the scene as parameter
        )

        self.play(timeline.next_time_scroll())

        texts = [
            "Estadística y probabilidad van de la mano, Bernoulli, Maseres, Lagrange y Laplace desarrollaron la teoría de probabilidades",
            "Fisher y Pearson contribuyen a la estadística como disciplina científica, elaboran herramientas para la planeación y análisis de experimentos (varianza y análisis multivariante)",
            "Crece la estadística descriptiva en lo social y económico",
            "Actualmente la estadística es un método interdisciplinar que permite describir con la mayor exactitud datos de diferentes campos: político, social, psicológico, biológico y físico. Es importante la interpretación de los datos tomados",
        ]

        images = [
            "laplace.jpg", "fisher.jpg", "pearson.jpg", "stats_modern.svg"
        ]

        image_scales = [1, 0.35, 0.6, 1]

        for i, text in enumerate(texts):
            paragraph = presets.PTex(text=text,
                                     alignment=line_alignment,
                                     line_length=line_length,
                                     interline_space=0.1,
                                     **configs.text_config)

            paragraph.width = paragraph_width
            paragraph.align_on_border(LEFT, buff=3)

            remaining_space = (Point().align_on_border(
                RIGHT, buff=0).get_center()) - (paragraph.get_corner(RIGHT))

            # Imagen

            if i < 3:
                stats_image = ImageMobject(
                    filename_or_array=presets.image_path(images[i]))
                # stats_image.scale_to_fit_width(remaining_space - 1)
                # stats_image.height = 5

            else:
                stats_image = SVGMobject(
                    file_name=os.path.join("assets", "svg", images[i]))
                stats_image.set_color(WHITE)
                # stats_image.scale_to_fit_width(remaining_space - 1)

            stats_image.scale(image_scales[i])
            stats_image.next_to(paragraph, RIGHT, buff=0.7)

            if i < 3:
                self.play(Write(paragraph), FadeIn(stats_image), run_time=3)

            else:
                self.play(Write(paragraph),
                          DrawBorderThenFill(stats_image),
                          run_time=3)

            self.wait(2)

            self.play(
                Uncreate(paragraph),
                FadeOut(stats_image),
                # FadeOutAndShift(pickaxe_svg, UP_SCREEN),
            )

            self.wait()
Exemplo n.º 10
0
    def construct(self):

        frame_height = self.camera.frame_height
        frame_width = self.camera.frame_width

        timeline = presets.TimeLine(**configs.timeline_config)
        timeline.next_to(REFERENCE_POINT, DOWN, buff=0)
        timeline.preload_for_scene(
            target_time="Siglo XVI",
            scene=self  # pass the scene as parameter
        )

        self.play(timeline.next_time_scroll())

        line_alignment = "left"
        line_length = 35
        paragraph_width = frame_width / 2.4

        text_points = [
            "Se hizo obligatorio dar un reporte a la hacienda pública y se estableció la metodología para realizar censos.",
            "Se creó la primer oficina de estadística nacional y se publicó el primer anuario",
        ]

        joined_text = "\n".join(text_points)

        bullet_points = VGroup()

        for line in text_points:
            paragraph = presets.PTex(text=line,
                                     alignment=line_alignment,
                                     line_length=line_length,
                                     interline_space=0.2,
                                     **configs.text_config)

            bullet_dot = MathTex(r"\cdot").scale(2)
            bullet_dot.next_to(paragraph.submobjects[0], LEFT, buff=0.3)

            bullet_points.add(VGroup(bullet_dot, paragraph))

        bullet_points.width = paragraph_width

        bullet_points.arrange(DOWN, buff=0.5)

        for prev_index, current in enumerate(bullet_points[1:]):

            current.align_to(bullet_points[prev_index], LEFT, LEFT)

        bullet_points.align_on_border(LEFT, buff=3)
        remaining_space = (Point().align_on_border(
            RIGHT, buff=0).get_center()) - (bullet_points.get_corner(RIGHT))
        # remaining_midpoint = (Point().align_on_border(RIGHT, buff=0).get_center()) + (bullet_points.get_corner(RIGHT))/2

        # Imagen

        stats_image = ImageMobject(
            filename_or_array=presets.image_path("dane.png"))
        stats_image.scale_to_fit_width(remaining_space - 1.5)
        stats_image.stretch_to_fit_height(5)

        stats_image.next_to(bullet_points, RIGHT, buff=1)

        self.play(Write(bullet_points), FadeIn(stats_image), run_time=3)

        # self.play(Write(paragraph), DrawBorderThenFill(coins_svg))
        # self.play(DrawBorderThenFill(pickaxe_svg), run_time=2)
        # # self.play(Write(paragraph), Create(graph))
        self.wait(2)

        self.play(
            FadeOutAndShift(bullet_points, UP_SCREEN),
            FadeOutAndShift(stats_image, UP_SCREEN),
            # FadeOutAndShift(pickaxe_svg, UP_SCREEN),
        )