def construct(self): srcs = VGroup( presets.PTex( r"S. Hernandez G. (2005, Mayo-Agosto). Historia de la estadística. [Online]. Available: https://www.uv.mx/cienciahombre/revistae/vol18num2/articulos/historia/", **self.text_config, ), presets.PTex( r"Some book name or source. [Online]. Available: <link>", **self.text_config, ), presets.PTex( r"M.H. Badii, J. Castillo, J. Landeros \& K. Cortez. (2007, Enero-Junio). Papel de la estadística en la investigación científica. [Online]. Available: http://revistainnovaciones.uanl.mx/index.php/revin/article/view/180", **self.text_config, ), presets.PTex( r"Some book name or source. [Online]. Available: <link>", **self.text_config, ), ).scale(1.8) for mob in srcs: mob.scale(0.3) srcs.move_to(self.ref_point) srcs.arrange_submobjects(DOWN, buff=0.5) dots = VGroup() interline_space = 0.1 for mob in srcs: mob.align_to(self.ref_point, LEFT) # mob[1].next_to(mob[0], DOWN, buff=interline_space).align_to( # self.ref_point, LEFT # ) dot = Dot(**self.dot_config) dot.next_to(mob[0], LEFT, buff=0.2) dots.add(dot) header = Title("Bibliografía", **self.header_config) self.play(Write(header), run_time=2) self.play( Write(srcs), AnimationGroup(Wait(1), DrawBorderThenFill(dots), lag_ratio=1), run_time=4, ) self.wait() self.play( # FadeOut(header), FadeOut(srcs, shift=DOWN), FadeOut(dots, shift=DOWN), run_time=2, )
def construct(self): srcs = VGroup( presets.PTex( r"S. Hernandez G. (2005, Mayo-Agosto). Historia de la estadística. [Online]. Available: https://www.uv.mx/cienciahombre/revistae/vol18num2/articulos/historia/", **self.text_config, ), presets.PTex( r"Y. Díaz. (2013, Noviembre). La estadística en Colombia, una evolución fundamental para la toma de decisiones. [Online]. Available: https: // www.dane.gov.co/files/lineadetiempodane/index.html", **self.text_config, ), presets.PTex( r"M.H. Badii, J. Castillo, J. Landeros \& K. Cortez. (2007, Enero-Junio). Papel de la estadística en la investigación científica. [Online]. Available: http://revistainnovaciones.uanl.mx/index.php/revin/article/view/180", **self.text_config, ), presets.PTex( r"J. F. López. (2019, Julio 22). Historia de la estadística. [Online]. Available: https://economipedia.com/definiciones/historia-de-la-estadistica.html", **self.text_config, ), ).scale(1.8) for mob in srcs: mob.scale(0.3) srcs.move_to(self.ref_point) srcs.arrange_submobjects(DOWN, buff=0.5) dots = VGroup() interline_space = 0.1 for mob in srcs: mob[0].align_to(self.ref_point, LEFT) mob[1].next_to(mob[0], DOWN, buff=interline_space).align_to( self.ref_point, LEFT) dot = Dot(**self.dot_config) dot.next_to(mob[0], LEFT, buff=0.2) dots.add(dot) header = Title("Bibliografía", **self.text_config) self.play(Write(header), run_time=2) self.play( Write(srcs), AnimationGroup(Wait(1), DrawBorderThenFill(dots), lag_ratio=1), run_time=4, ) self.wait() self.play( # FadeOut(header), FadeOutAndShift(srcs, DOWN), FadeOutAndShift(dots, DOWN), run_time=2, )
def __init__(self, *args, **kwargs): super().__init__(start_time="594 A.C.", *args, **kwargs) self.paragraph_config["line_length"] = 35 self.wait() self.previous = { "image": ImageMobject(filename_or_array=image_path( ".\\history\\11_greek_census.jpg")), "text": presets.PTex( "Realizaron estadística sobre distribución de terreno y servicio militar, también se registraron censos para el cálculo de impuestos y derechos de voto", alignment="left", **self.paragraph_config, ), "title": VGroup(Tex("Estádistica en Grecia", **self.title_config)), } self.scales["text"] = 0.65 self.previous["text"].scale(self.scales["text"]).next_to( self.cur_time, RIGHT, buff=self.buffs["text"]).shift(self.shifts["text"]) self.previous["image"].scale(0.75).next_to(self.previous["text"], RIGHT, buff=self.buffs["image"]) self.position_title(self.previous["title"], self.previous["image"]) self.add(*self.previous.values())
def __init__(self, *args, **kwargs): super().__init__(start_time="Biblia", *args, **kwargs) self.paragraph_config["line_length"] = 35 self.wait() # this fix the bug of updaters not being updated -_- self.previous = { "image": ImageMobject( filename_or_array=image_path(".\\history\\9_pentateuco.png")), "text": presets.PTex( "Se observa en el pentateuco (libro de números) un censo realizado por moisés en su salida de Egipto", alignment="left", **self.paragraph_config, ), "title": Tex("Pentateuco", **self.title_config), } # previous config self.previous["text"].scale(self.scales["text"]).next_to( self.cur_time, RIGHT, buff=self.buffs["text"]).shift(self.shifts["text"]) self.previous["text"].shift(RIGHT * 0.33) self.previous["image"].scale(0.8).next_to(self.previous["text"], RIGHT, buff=self.buffs["image"]) self.position_title(self.previous["title"], self.previous["image"]) self.add(*self.previous.values())
def __init__(self, *args, **kwargs): super().__init__(start_time="Epoca antigua", *args, **kwargs) # image is set apart since can't be in a VGroup self.paragraph_config["line_length"] = 28 self.previous = { "image": ImageMobject( filename_or_array=image_path(".\\history\\5_egyptians.jfif")), "text": presets.PTex( "Esta organización permite la construcción de piramides en Egipto y la elaboración de censos de población", alignment="left", **self.paragraph_config, ), "title": Tex("Antiguo Egipto", **self.title_config), } self.previous["text"].scale(self.scales["text"]).next_to( self.cur_time, RIGHT, buff=self.buffs["text"]).shift(self.shifts["text"]) self.previous["image"].scale(0.85).next_to(self.previous["text"], RIGHT, buff=self.buffs["image"]) self.previous["title"].scale(self.scales["title"]).next_to( self.previous["image"], UP, buff=self.buffs["title"]) self.add(*self.previous.values())
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)
def __init__(self, *args, **kwargs): super().__init__(start_time="762 A.C.", *args, **kwargs) self.paragraph_config["line_length"] = 32 self.wait() self.previous = { "image": ImageMobject(filename_or_array=image_path( ".\\history\\10_sargon_library.jpg")), "text": presets.PTex( "Sargon II Fundo una biblioteca en nínive donde recopila:", **self.paragraph_config, ), "group": VGroup( Tex("Biblioteca de Ashurbanipal", **self.title_config), BulletedList( "Hechos e historias a la fecha", "Documentos religiosos", "Datos estadisticos sobre producción \\\\y cuentas en general", dot_scale_factor=2, **self.paragraph_config, ), ), } for line in self.previous["group"][1]: line[0].set_color(SKY_BLUE) self.previous["text"].scale(self.scales["text"]).next_to( self.cur_time, RIGHT).align_on_border( RIGHT, self.buffs["right border"]).shift(self.shifts["text"]) self.previous["group"][1].scale(self.scales["list"]).next_to( self.previous["text"], DOWN, aligned_edge=LEFT).shift(RIGHT * self.buffs["indentation"]) self.previous["image"].scale(1.2).next_to(self.previous["text"], LEFT, buff=self.buffs["image"]) VGroup(self.previous["text"], self.previous["group"][1]).shift(UP * 0.8) self.position_title(self.previous["group"][0], self.previous["image"]) self.add(*self.previous.values(), )
def construct(self): self.wait() # images and text pentateuco = { "image": ImageMobject( filename_or_array=image_path(".\\history\\9_pentateuco.png")), "text": presets.PTex( "Se observa en el pentateuco (libro de números) un censo realizado por moisés en su salida de Egipto", alignment="left", **self.paragraph_config, ), "title": Tex("Pentateuco", **self.title_config), } pentateuco["text"].scale(self.scales["text"]).next_to( self.cur_time, RIGHT, buff=self.buffs["text"]).shift(self.shifts["text"]) pentateuco["image"].scale(0.8).next_to(pentateuco["text"], RIGHT, buff=self.buffs["image"]) self.position_title(pentateuco["title"], pentateuco["image"]) # animations # self.add( # pentateuco["image"], # pentateuco["text"], # pentateuco["title"], # pentateuco["src"], # ) self.play( self.timeline.next_time_scroll(), # fade out previous mobs AnimationGroup( *[ FadeOutAndShift(image, self.points["out screen up"]) for image in self.previous["images"] ], lag_ratio=0, ), FadeOutAndShift(self.previous["group"], self.points["out screen up"]), *self.get_scroll_animation(pentateuco), run_time=4, ) self.wait()
def construct(self): self.paragraph_config["line_length"] = 35 greeks = { "image": ImageMobject(filename_or_array=image_path( ".\\history\\11_greek_census.jpg")), "title": Tex("Estádistica en Grecia", **self.title_config), "text": presets.PTex( "Realizaron estadística sobre distribución de terreno y servicio militar, también se registraron censos para el cálculo de impuestos y derechos de voto", alignment="left", **self.paragraph_config, ), } self.scales["text"] = 0.65 greeks["text"].scale(self.scales["text"]).next_to( self.cur_time, RIGHT, buff=self.buffs["text"]).shift(self.shifts["text"]) greeks["image"].scale(0.75).next_to(greeks["text"], RIGHT, buff=self.buffs["image"]) self.position_title(greeks["title"], greeks["image"]) # animations # self.add( # greeks["image"], # greeks["text"], # greeks["title"], # ) self.play( self.timeline.next_time_scroll(), # fade out previous mobs FadeOutAndShift(self.previous["image"], self.points["out screen up"]), FadeOutAndShift( VGroup(*self.previous["group"], self.previous["text"]), self.points["out screen up"], ), *self.get_scroll_animation(greeks), run_time=4, ) self.wait()
def construct(self): # images and text self.paragraph_config["line_length"] = 32 sargon = { "image": ImageMobject(filename_or_array=image_path( ".\\history\\10_sargon_library.jpg")), "title": Tex("Biblioteca de Ashurbanipal", **self.title_config), "text": presets.PTex( "Sargon II Fundo una biblioteca en nínive donde recopila:", **self.paragraph_config, ), "list": BulletedList( "Hechos e historias a la fecha", "Documentos religiosos", "Datos estadisticos sobre producción \\\\y cuentas en general", dot_scale_factor=2, **self.paragraph_config, ), } # add colors to dots for line in sargon["list"]: line[0].set_color(self.colors["bullet dot"]) sargon["text"].scale(self.scales["text"]).next_to( self.cur_time, RIGHT).align_on_border( RIGHT, self.buffs["right border"]).shift(self.shifts["text"]) sargon["list"].scale(self.scales["list"]).next_to( sargon["text"], DOWN, aligned_edge=LEFT).shift(RIGHT * self.buffs["indentation"]) sargon["image"].scale(1.2).next_to(sargon["text"], LEFT, buff=self.buffs["image"]) VGroup(sargon["text"], sargon["list"]).shift(UP * 0.8) self.position_title(sargon["title"], sargon["image"]) # animations # self.add( # sargon["image"], # sargon["text"], # sargon["title"], # sargon["list"], # sargon["src"] # ) self.play( self.timeline.next_time_scroll(), # fade out previous mobs FadeOutAndShift(self.previous["image"], self.points["out screen up"]), FadeOutAndShift( VGroup(self.previous["group"], self.previous["text"]), self.points["out screen up"], ), *self.get_scroll_animation(sargon), run_time=4, ) self.wait()
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()
def construct(self): self.paragraph_config["line_length"] = 35 # images and text clay_splints = { "image": ImageMobject(filename_or_array=image_path( ".\\history\\6_clay_splints.jpg")), "title": Tex("Babilonios", alignment="left", **self.title_config), "text": presets.PTex("Tablillas de arcilla", **self.paragraph_config), } pyramids = { "image": ImageMobject( filename_or_array=image_path(".\\history\\7_pyramids.jpg")), "title": Tex("Egipcios", **self.title_config), "text": presets.PTex( "La organización del pueblo condujo a la construcción de las piramides", alignment="left", **self.paragraph_config, ), } chinese_agriculture = { "image": ImageMobject(filename_or_array=image_path( ".\\history\\8_chinese_agriculture.jpg")), "title": Tex("Chinos", **self.title_config), "text": presets.PTex( "Estadística agricola, comercial e industrial", alignment="left", **self.paragraph_config, ), } img_spacing = 1 img_scale = 0.42 # position images clay_splints["image"].scale(img_scale).next_to( self.timeline.get_arrow(), RIGHT, buff=3).shift(UP * 1.2) pyramids["image"].match_width(clay_splints["image"]).next_to( clay_splints["image"], DOWN, buff=img_spacing).align_to(clay_splints["image"], LEFT) chinese_agriculture["image"].match_width( clay_splints["image"]).next_to(pyramids["image"], DOWN, buff=img_spacing).align_to( pyramids["image"], LEFT) clay_splints["text"].scale(self.scales["text"]).next_to( clay_splints["image"], RIGHT, buff=self.buffs["text"]) pyramids["text"].scale(self.scales["text"]).next_to( pyramids["image"], RIGHT, buff=self.buffs["text"]) chinese_agriculture["text"].scale(self.scales["text"]).next_to( chinese_agriculture["image"], RIGHT, buff=self.buffs["text"]) clay_splints["title"].scale(self.scales["title"]).next_to( clay_splints["image"], UP, buff=self.buffs["title"]) pyramids["title"].scale(self.scales["title"]).next_to( pyramids["image"], UP, buff=self.buffs["title"]) chinese_agriculture["title"].scale(self.scales["title"]).next_to( chinese_agriculture["image"], UP, buff=self.buffs["title"]) # self.add( # clay_splints["image"], pyramids["image"], chinese_agriculture["image"], # clay_splints["title"], pyramids["title"], chinese_agriculture["title"], # clay_splints["text"], pyramids["text"], chinese_agriculture["text"], # clay_splints["src"], pyramids["src"], chinese_agriculture["src"], # ) self.play( self.timeline.next_time_scroll(), # fade out previous mobs FadeOutAndShift(self.previous["image"], self.points["out screen up"]), FadeOutAndShift(self.previous["text"], self.points["out screen up"]), FadeOutAndShift(self.previous["title"], self.points["out screen up"]), AnimationGroup( Wait(1), AnimationGroup( FadeInFrom(clay_splints["image"]), FadeInFrom(pyramids["image"]), FadeInFrom(chinese_agriculture["image"]), ), DrawBorderThenFill( VGroup( clay_splints["title"], pyramids["title"], chinese_agriculture["title"], )), lag_ratio=1, ), AnimationGroup( Wait(1.2), # write content AnimationGroup( Write(clay_splints["text"]), Write(pyramids["text"]), Write(chinese_agriculture["text"]), lag_ratio=0, ), lag_ratio=1, ), run_time=4, ) self.wait()
def construct(self): return self.paragraph_config["line_length"] = 28 # images and text farming = { "image": ImageMobject( filename_or_array=image_path(".\\history\\4_farming.jfif")), "title": Tex("Registro de ganado", **self.title_config), "text": presets.PTex( "Se encontraron registros de rocas que habian sido empleadas para registrar la cantidad de ganado, alimento o personas en aldeas", alignment="right", **self.paragraph_config, ), } egyptians = { "image": ImageMobject( filename_or_array=image_path(".\\history\\5_egyptians.jfif")), "title": Tex("Antiguo Egipto", **self.title_config), "text": presets.PTex( "Esta organización permite la construcción de piramides en Egipto y la elaboración de censos de población", alignment="left", **self.paragraph_config, ), } farming["text"].scale(self.scales["text"]).next_to( self.cur_time, RIGHT).align_on_border( RIGHT, self.buffs["right border"]).shift(self.shifts["text"]) egyptians["text"].scale(self.scales["text"]).next_to( self.cur_time, RIGHT, buff=self.buffs["text"]).shift(self.shifts["text"]) farming["image"].scale(0.99).next_to(farming["text"], LEFT, buff=self.buffs["image"]) egyptians["image"].scale(0.85).next_to(egyptians["text"], RIGHT, buff=self.buffs["image"]) farming["title"].scale(self.scales["title"]).next_to( farming["image"], UP, buff=self.buffs["title"]) egyptians["title"].scale(self.scales["title"]).next_to( egyptians["image"], UP, buff=self.buffs["title"]) # self.add( # farming["image"], farming["text"], farming["src"], farming["title"], # # egyptians["image"], egyptians["text"], egyptians["src"], egyptians["src"] # ) self.play( FadeIn(farming["image"]), AnimationGroup(Wait(0.5), DrawBorderThenFill(farming["title"]), lag_ratio=1), AnimationGroup(Wait(0.6), Write(farming["text"]), lag_ratio=1), run_time=4, ) self.wait() self.play( FadeOut(farming["image"]), FadeOut(VGroup( farming["text"], farming["title"], )), AnimationGroup( Wait(1), FadeIn(egyptians["image"]), DrawBorderThenFill(egyptians["title"]), lag_ratio=1, ), AnimationGroup( Wait(1.5), AnimationGroup(FadeIn(egyptians["text"]), ), lag_ratio=1, ), run_time=4, ) self.wait()
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), )
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), )
def __init__(self, *args, **kwargs): super().__init__(start_time="3000 A.C.", *args, **kwargs) # image is set apart since can't be in a VGroup self.paragraph_config["line_length"] = 35 self.wait() self.previous = { "images": [ ImageMobject(filename_or_array=image_path( ".\\history\\6_clay_splints.jpg")), ImageMobject(filename_or_array=image_path( ".\\history\\7_pyramids.jpg")), ImageMobject(filename_or_array=image_path( ".\\history\\8_chinese_agriculture.jpg")), ], "group": VGroup( Tex("Babilonios", **self.title_config), presets.PTex("Tablillas de arcilla", **self.paragraph_config), Tex("Egipcios", **self.title_config), presets.PTex( "La organización del pueblo condujo a la construcción de las piramides", **self.paragraph_config, ), Tex("Chinos", **self.title_config), presets.PTex( "Estadística agricola, comercial e industrial", **self.paragraph_config, ), ), } img_spacing = 1 img_scale = 0.42 # position images self.previous["images"][0].scale(img_scale).next_to( self.timeline.get_arrow(), RIGHT, buff=3).shift(UP * 1.2) self.previous["images"][1].match_width( self.previous["images"][0]).next_to(self.previous["images"][0], DOWN, buff=img_spacing) self.previous["images"][1].align_to(self.previous["images"][0], LEFT) self.previous["images"][2].match_width( self.previous["images"][0]).next_to(self.previous["images"][1], DOWN, buff=img_spacing) self.previous["images"][2].align_to(self.previous["images"][1], LEFT) self.previous["group"][0].scale(self.scales["title"]).next_to( self.previous["images"][0], UP, buff=self.buffs["title"]) self.previous["group"][1].scale(self.scales["text"]).next_to( self.previous["images"][0], RIGHT, buff=self.buffs["text"]) self.previous["group"][2].scale(self.scales["title"]).next_to( self.previous["images"][1], UP, buff=self.buffs["title"]) self.previous["group"][3].scale(self.scales["text"]).next_to( self.previous["images"][1], RIGHT, buff=self.buffs["text"]) self.previous["group"][4].scale(self.scales["title"]).next_to( self.previous["images"][2], UP, buff=self.buffs["title"]) self.previous["group"][5].scale(self.scales["text"]).next_to( self.previous["images"][2], RIGHT, buff=self.buffs["text"]) self.add(*self.previous["images"], self.previous["group"])
def scene_bar_plot(self): plot = (ImageMobject( filename_or_array=f"{ROOT_PATH}/assets/images/bar-plot.png"). scale_to_fit_width(7).to_edge(LEFT, buff=0.7)) TEXT_SCALE = 0.5 text = VGroup( Tex( "Los valores utilizados fueron el ", "semestre \\\\", "y el ", "dispositivo ", " empleado para recibir las \\\\", "clases virtuales.", ).set_color_by_tex_to_color_map({ "semestre": SKY_BLUE, "dispositivo": SKY_BLUE }), presets.PTex( "Los datos fueron normalizados para apreciar de mejor manera la proporción de uso de los dispositivos por semestre.", alignment="left", line_length=32, interline_space=0.2, ), ) # align paragraph lines VGroup(text[0][:2], text[0][2:5], text[0][-1]).arrange(DOWN, aligned_edge=LEFT) text.scale(TEXT_SCALE).arrange_submobjects(DOWN, aligned_edge=LEFT, buff=1).to_edge(edge=RIGHT, buff=1) self.play( Transform( self.title, Tex("Diagrama de Barras", **self.config["title"]).move_to(self.title), ), run_time=1.2, ) self.wait() self.play( FadeIn(plot, shift=RIGHT), AnimationGroup(Wait(2), Write(text[0]), lag_ratio=1), run_time=3, ) self.wait() self.play(Write(text[1]), run_time=2) self.wait() self.play( FadeOut(text), AnimationGroup( Wait(1), plot.animate.scale_to_fit_width(9).move_to(DOWN * 0.5), lag_ratio=1, ), run_time=2, ) self.wait(3) self.ignore_mobs = [self.title]
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), )