# -*- coding: utf-8 -*- import sys, os sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from manim import * from tiktok import * class Nueves(TikTok): NAME = "nueves" def construct(self): self.prepare() chip = self.chip("Matemática que enoja", ROSA) # --- el numero --- with self.beat(0) as b: head = Text("0,", font=FONT, font_size=110, weight=BOLD, color=WHITE) nines = VGroup(*[Text("9", font=FONT, font_size=110, weight=BOLD, color=AMBAR) for _ in range(6)]) dots = Text("…", font=FONT, font_size=110, weight=BOLD, color=AMBAR) num = VGroup(head, *nines, dots).arrange(RIGHT, buff=0.06) self.fit(num, 8.0).move_to(UP * 4.5) b.play(FadeIn(chip, shift=DOWN * 0.3), run_time=0.45) b.play(FadeIn(head), run_time=0.3) b.play(LaggedStart(*[FadeIn(n, shift=DOWN * 0.25) for n in nines], lag_ratio=0.5), run_time=1.1) b.play(Write(dots), run_time=0.4) # --- es igual a 1 --- with self.beat(1) as b: eq = MathTex("=", color=WHITE).scale(2.2).move_to(UP * 2.4) one = MathTex("1", color=VERDE).scale(3.2).next_to(eq, DOWN, buff=0.35) b.play(Write(eq), run_time=0.4) b.play(FadeIn(one, scale=0.5), run_time=0.5) b.play(Flash(one, color=VERDE, line_length=0.5, num_lines=16, flash_radius=1.1), run_time=0.7) equals = VGroup(eq, one) # --- la objecion --- with self.beat(2) as b: bubble = RoundedRectangle(corner_radius=0.35, width=7.4, height=1.5, stroke_color=GRIS, stroke_width=4, fill_color="#151C2E", fill_opacity=1).move_to(UP * 0.9) obj = self.fit(Text("«pero le falta un poquito»", font=FONT, font_size=42, weight=BOLD, color=GRIS), 6.9).move_to(bubble) b.play(FadeOut(equals), run_time=0.3) b.play(FadeIn(bubble), Write(obj), run_time=1.0) # --- decime cuanto --- with self.beat(3) as b: q = MathTex(r"1 - 0{,}999\ldots \;=\; ?", color=WHITE).scale(1.6).move_to(UP * 1.5) q[0][-1].set_color(ROSA) b.play(FadeOut(VGroup(bubble, obj)), run_time=0.3) b.play(Write(q), run_time=1.1) b.play(Indicate(q[0][-1], color=ROSA, scale_factor=1.6), run_time=0.8) # --- la recta: no hay lugar en el medio --- line = Line(LEFT * 3.4, RIGHT * 3.4, stroke_width=7, color="#3A4766").move_to(UP * 0.55) dA = Dot(line.get_left() + RIGHT * 1.4, radius=0.15, color=AMBAR) dB = Dot(line.get_right(), radius=0.15, color=VERDE) lA = MathTex("0{,}999\\ldots", color=AMBAR).scale(1.0).next_to(dA, DOWN, buff=0.45) lB = MathTex("1", color=VERDE).scale(1.4).next_to(dB, DOWN, buff=0.45) with self.beat(4) as b: b.play(FadeOut(q), run_time=0.25) b.play(Create(line), run_time=0.5) b.play(FadeIn(dA), FadeIn(dB), Write(lA), Write(lB), run_time=0.8) brace = Brace(Line(dA.get_center(), dB.get_center()), UP, color=ROSA, buff=0.15) ask = Text("¿qué número entra acá?", font=FONT, font_size=34, weight=BOLD, color=ROSA).next_to(brace, UP, buff=0.2) self.fit(ask, 7.5) b.play(GrowFromCenter(brace), FadeIn(ask), run_time=0.8) gap = VGroup(brace, ask) with self.beat(5) as b: b.play(dA.animate.move_to(dB.get_center()), lA.animate.next_to(dB, DOWN, buff=0.45).shift(LEFT * 1.3), FadeOut(gap), run_time=1.2) none = Text("nada: es el mismo punto", font=FONT, font_size=40, weight=BOLD, color=VERDE).move_to(DOWN * 1.9) b.play(Flash(dB, color=VERDE, line_length=0.6, num_lines=18, flash_radius=1.2), FadeIn(self.fit(none, 7.8), shift=UP * 0.2), run_time=0.9) recta = VGroup(line, dA, dB, lA, lB, none) # --- la demostracion --- with self.beat(6) as b: p1 = MathTex(r"\frac{1}{3} = 0{,}333\ldots", color=WHITE).scale(1.9).move_to(UP * 3.7) b.play(FadeOut(VGroup(recta, num, head, dots, *nines)), run_time=0.45) b.play(Write(p1), run_time=1.1) with self.beat(7) as b: x3 = Text("× 3", font=FONT, font_size=60, weight=BOLD, color=AMBAR).move_to(UP * 1.75) ar = VGroup( Arrow(UP * 2.75 + LEFT * 2.1, UP * 0.75 + LEFT * 2.1, buff=0, color=AMBAR, stroke_width=8), Arrow(UP * 2.75 + RIGHT * 2.1, UP * 0.75 + RIGHT * 2.1, buff=0, color=AMBAR, stroke_width=8), ) b.play(FadeIn(x3, scale=0.6), run_time=0.5) b.play(*[GrowArrow(a) for a in ar], run_time=0.7) with self.beat(8) as b: p2 = MathTex(r"\frac{3}{3} = 0{,}999\ldots", color=WHITE).scale(1.9).move_to(DOWN * 0.55) p2[0][0].set_color(VERDE); p2[0][2].set_color(VERDE) b.play(Write(p2), run_time=1.3) b.play(Circumscribe(p2, color=CELESTE, buff=0.3, stroke_width=6), run_time=0.9) with self.beat(9) as b: final = MathTex(r"1 = 0{,}999\ldots", color=VERDE).scale(2.3).move_to(DOWN * 2.6) b.play(FadeOut(VGroup(x3, ar)), run_time=0.3) b.play(TransformFromCopy(p2, final), run_time=1.2) b.play(Flash(final, color=VERDE, line_length=0.7, num_lines=22, flash_radius=2.2), run_time=0.9) with self.beat(10) as b: b.play(FadeOut(VGroup(p1, p2)), run_time=0.4) cta = self.fit(Text("¿te convencí?", font=FONT, font_size=72, weight=BOLD, color=AMBAR), 7.9).move_to(UP * 2.2) sub = Text("escribilo en los comentarios", font=FONT, font_size=40, color=GRIS).next_to(cta, DOWN, buff=0.4) b.play(Write(cta), run_time=0.8) b.play(FadeIn(sub, shift=UP * 0.2), run_time=0.5) self.finish()