# -*- coding: utf-8 -*- import sys, os, math sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from manim import * from tiktok import * XA, XB = 1.0, 7.4 # dominio de 1/x KX, KY = 1.00, 2.00 # escala a pantalla X0S, CY = -3.75, 1.70 def sx(x): return X0S + (x - XA) * KX def sy(x): return KY / x def rama(sig, n=160, **kw): xs = np.linspace(XA, XB, n) pts = [[sx(x), CY + sig * sy(x), 0] for x in xs] m = VMobject(**kw) m.set_points_as_corners(pts) return m def cuerpo(fill="#1E4E8C", op=0.55): xs = np.linspace(XA, XB, 160) up = [[sx(x), CY + sy(x), 0] for x in xs] dn = [[sx(x), CY - sy(x), 0] for x in reversed(xs)] m = VMobject(stroke_width=0, fill_color=fill, fill_opacity=op) m.set_points_as_corners(up + dn + [up[0]]) return m def aros(n=9, col=CELESTE, op=0.55): xs = np.linspace(XA + 0.35, XB, n) return VGroup(*[ Ellipse(width=0.34, height=2 * sy(x), stroke_width=3, stroke_opacity=op, color=col).move_to([sx(x), CY, 0]) for x in xs]) class Gabriel(TikTok): NAME = "gabriel" def construct(self): self.prepare() chip = self.chip("Paradoja del infinito", CELESTE) with self.beat(0) as b: b.play(FadeIn(chip, shift=DOWN * 0.3), run_time=0.45) t = VGroup( self.fit(Text("el cuerno de", font=FONT, font_size=50, weight=BOLD, color=WHITE), 8.0), self.fit(Text("GABRIEL", font=FONT, font_size=86, weight=BOLD, color=AMBAR), 8.0), ).arrange(DOWN, buff=0.25).move_to(UP * 2.6) b.play(FadeIn(t[0], shift=UP * 0.15), run_time=0.5) b.play(FadeIn(t[1], scale=0.7), run_time=0.8) eje = Line([sx(XA) - 0.5, CY, 0], [sx(XB) + 0.35, CY, 0], stroke_width=3, color="#33405C") with self.beat(1) as b: b.play(t.animate.scale(0.5).move_to(UP * 5.3), run_time=0.5) f = MathTex(r"y = \frac{1}{x}", color=AMBAR).scale(1.35).move_to(DOWN * 2.4) up = rama(+1, stroke_color=AMBAR, stroke_width=6) b.play(FadeIn(eje), run_time=0.3) b.play(Create(up), run_time=0.9) b.play(Write(f), run_time=0.7) body = cuerpo() low = rama(-1, stroke_color=AMBAR, stroke_width=6) ar = aros() boca = Ellipse(width=0.42, height=2 * sy(XA), stroke_width=6, color=AMBAR).move_to([sx(XA), CY, 0]) with self.beat(2) as b: b.play(Create(low), run_time=0.6) b.play(FadeIn(body), FadeIn(boca), run_time=0.5) b.play(LaggedStart(*[Create(a) for a in ar], lag_ratio=0.15), run_time=0.9) inf = MathTex(r"\cdots \infty", color=GRIS).scale(1.0) inf.next_to([sx(XB), CY, 0], RIGHT, buff=0.2) b.play(FadeIn(inf), run_time=0.4) horn = VGroup(eje, body, up, low, ar, boca, inf) with self.beat(3) as b: b.play(FadeOut(f), run_time=0.25) q = self.fit(Text("¿cuánta pintura entra?", font=FONT, font_size=52, weight=BOLD, color=WHITE), 8.2).move_to(DOWN * 2.3) b.play(FadeIn(q, shift=UP * 0.15), run_time=0.7) with self.beat(4) as b: b.play(FadeOut(q), run_time=0.25) lleno = cuerpo(fill=VERDE, op=0.85) b.play(FadeIn(lleno), run_time=0.7) v = MathTex(r"V = \pi\int_1^{\infty}\frac{dx}{x^2} = \pi", color=VERDE).scale(1.15).move_to(DOWN * 2.05) b.play(Write(v), run_time=1.1) with self.beat(5) as b: lt = self.fit(Text("≈ 3,14 litros y te sobra", font=FONT, font_size=48, weight=BOLD, color=VERDE), 8.2).move_to(DOWN * 2.90) b.play(FadeIn(lt, shift=UP * 0.15), run_time=0.7) with self.beat(6) as b: b.play(FadeOut(VGroup(v, lt, lleno)), run_time=0.4) q2 = self.fit(Text("¿y pintarlo por fuera?", font=FONT, font_size=52, weight=BOLD, color=WHITE), 8.2).move_to(DOWN * 2.3) b.play(up.animate.set_stroke(ROSA, 8), low.animate.set_stroke(ROSA, 8), run_time=0.6) b.play(FadeIn(q2, shift=UP * 0.15), run_time=0.6) with self.beat(7) as b: b.play(FadeOut(q2), run_time=0.25) a = MathTex(r"A > 2\pi\int_1^{\infty}\frac{dx}{x} = \infty", color=ROSA).scale(1.15).move_to(DOWN * 2.15) b.play(Write(a), run_time=1.1) b.play(Flash(a, color=ROSA, line_length=0.5, num_lines=18, flash_radius=2.4), run_time=0.7) with self.beat(8) as b: b.play(FadeOut(VGroup(a, horn)), run_time=0.45) def fila(txt, val, col): t1 = Text(txt, font=FONT, font_size=44, weight=BOLD, color=WHITE) t2 = Text(val, font=FONT, font_size=56, weight=BOLD, color=col) return VGroup(t1, t2).arrange(DOWN, buff=0.18) cmp = VGroup(fila("volumen", "π (finito)", VERDE), fila("superficie", "∞ (infinita)", ROSA) ).arrange(DOWN, buff=0.75).move_to(UP * 2.4) self.fit(cmp, 8.2) b.play(FadeIn(cmp[0], shift=UP * 0.15), run_time=0.55) b.play(FadeIn(cmp[1], shift=UP * 0.15), run_time=0.55) golpe = VGroup( self.fit(Text("lo llenás de pintura", font=FONT, font_size=48, weight=BOLD, color=WHITE), 8.2), self.fit(Text("pero no lo podés pintar", font=FONT, font_size=48, weight=BOLD, color=AMBAR), 8.2), ).arrange(DOWN, buff=0.3).move_to(DOWN * 0.6) b.play(FadeIn(golpe, scale=0.85), run_time=0.8) with self.beat(9) as b: b.play(FadeOut(VGroup(cmp, golpe)), run_time=0.4) tr = VGroup( self.fit(Text("la trampa:", font=FONT, font_size=48, weight=BOLD, color=ROSA), 8.2), self.fit(Text("la pintura real tiene", font=FONT, font_size=46, weight=BOLD, color=WHITE), 8.2), self.fit(Text("espesor. El cuerno", font=FONT, font_size=46, weight=BOLD, color=WHITE), 8.2), self.fit(Text("se hace más fino que eso.", font=FONT, font_size=46, weight=BOLD, color=WHITE), 8.2), ).arrange(DOWN, buff=0.3).move_to(UP * 1.8) for k in range(4): b.play(FadeIn(tr[k], shift=UP * 0.12), run_time=0.45) with self.beat(10) as b: b.play(FadeOut(tr), run_time=0.35) cta = VGroup( self.fit(Text("con el infinito", font=FONT, font_size=52, weight=BOLD, color=WHITE), 8.0), self.fit(Text("la intuición se rompe", font=FONT, font_size=56, weight=BOLD, color=AMBAR), 8.0), ).arrange(DOWN, buff=0.35).move_to(UP * 1.4) b.play(FadeIn(cta[0], shift=UP * 0.15), run_time=0.55) b.play(Write(cta[1]), run_time=0.9) b.play(Circumscribe(cta[1], color=AMBAR, buff=0.25, stroke_width=6), run_time=0.8) self.finish()