1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
# -*- coding: utf-8 -*-
import sys, os, math
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from manim import *
from tiktok import *
BAR_X0, BAR_MAX = -2.35, 3.3 # barra proporcional a los años
class Regla72(TikTok):
NAME = "regla72"
def fila(self, tasa, anios, y, color, maxa=12.0):
t = Text(f"{tasa}%", font=FONT, font_size=46, weight=BOLD, color=color)
t.move_to([-3.95, y, 0], LEFT)
w = max(anios / maxa * BAR_MAX, 0.05)
bar = RoundedRectangle(corner_radius=0.1, width=w, height=0.46, stroke_width=0,
fill_color=color, fill_opacity=1)
bar.move_to([BAR_X0, y, 0], LEFT)
lab = Text(f"{anios:g} años".replace(".", ","), font=FONT, font_size=40,
weight=BOLD, color=WHITE)
lab.next_to(bar, RIGHT, buff=0.25)
return VGroup(t, bar, lab)
def construct(self):
self.prepare()
chip = self.chip("Finanzas en 40 segundos", VERDE)
with self.beat(0) as b:
q = VGroup(
self.fit(Text("¿cuánto tarda tu plata", font=FONT, font_size=52,
weight=BOLD, color=WHITE), 8.2),
self.fit(Text("en duplicarse?", font=FONT, font_size=52,
weight=BOLD, color=AMBAR), 8.2),
).arrange(DOWN, buff=0.3).move_to(UP * 3.4)
b.play(FadeIn(chip, shift=DOWN * 0.3), run_time=0.45)
b.play(FadeIn(q[0], shift=UP * 0.15), run_time=0.6)
b.play(Write(q[1]), run_time=0.8)
with self.beat(1) as b:
name = self.fit(Text("LA REGLA DEL 72", font=FONT, font_size=66,
weight=BOLD, color=VERDE), 8.2).move_to(UP * 1.4)
b.play(FadeIn(name, scale=0.7), run_time=0.8)
b.play(Flash(name, color=VERDE, line_length=0.6, num_lines=20,
flash_radius=2.6), run_time=0.7)
with self.beat(2) as b:
f = MathTex(r"\frac{72}{\text{tasa anual}} = \text{años}",
color=WHITE).scale(1.5).move_to(DOWN * 0.6)
f[0][0:2].set_color(VERDE)
b.play(FadeOut(q), name.animate.scale(0.62).move_to(UP * 5.35), run_time=0.6)
b.play(Write(f), run_time=1.1)
rows = []
for i, (tasa, anios, col, yy) in enumerate(
[(6, 12, AMBAR, -2.6), (9, 8, CELESTE, -3.7), (12, 6, VERDE, -4.8)]):
rows.append(self.fila(tasa, anios, yy, col))
with self.beat(3) as b:
b.play(f.animate.scale(0.72).move_to(UP * 3.6), run_time=0.5)
for r in rows:
r.shift(UP * 4.3)
cuenta = MathTex(r"72 \div 6 = 12", color=AMBAR).scale(1.35).move_to(UP * 1.75)
b.play(Write(cuenta), run_time=0.8)
b.play(FadeIn(rows[0][0]), GrowFromEdge(rows[0][1], LEFT),
FadeIn(rows[0][2]), run_time=0.8)
with self.beat(4) as b:
c2 = MathTex(r"72 \div 9 = 8", color=CELESTE).scale(1.35).move_to(UP * 1.75)
b.play(Transform(cuenta, c2), run_time=0.6)
b.play(FadeIn(rows[1][0]), GrowFromEdge(rows[1][1], LEFT),
FadeIn(rows[1][2]), run_time=0.8)
with self.beat(5) as b:
c3 = MathTex(r"72 \div 12 = 6", color=VERDE).scale(1.35).move_to(UP * 1.75)
b.play(Transform(cuenta, c3), run_time=0.6)
b.play(FadeIn(rows[2][0]), GrowFromEdge(rows[2][1], LEFT),
FadeIn(rows[2][2]), run_time=0.8)
tabla = VGroup(*rows)
with self.beat(6) as b:
inv = self.fit(Text("y también al revés", font=FONT, font_size=50,
weight=BOLD, color=ROSA), 8.0).move_to(DOWN * 1.1)
b.play(FadeOut(cuenta), run_time=0.3)
b.play(FadeIn(inv, shift=UP * 0.15), run_time=0.7)
with self.beat(7) as b:
b.play(FadeOut(VGroup(tabla, inv)), run_time=0.45)
infl = VGroup(
self.fit(Text("30% de inflación anual", font=FONT, font_size=48,
weight=BOLD, color=ROSA), 8.2),
self.fit(Text("tu plata vale la mitad", font=FONT, font_size=44,
weight=BOLD, color=WHITE), 8.2),
self.fit(Text("en 2,4 años", font=FONT, font_size=56,
weight=BOLD, color=ROSA), 8.2),
).arrange(DOWN, buff=0.35).move_to(UP * 0.35)
b.play(FadeIn(infl[0], shift=UP * 0.15), run_time=0.6)
b.play(FadeIn(infl[1], shift=UP * 0.15), run_time=0.6)
b.play(FadeIn(infl[2], scale=0.7), run_time=0.7)
with self.beat(8) as b:
c4 = MathTex(r"72 \div 30 = 2{,}4", color=ROSA).scale(1.45).move_to(DOWN * 2.5)
b.play(Write(c4), run_time=1.0)
with self.beat(9) as b:
b.play(FadeOut(VGroup(infl, c4)), run_time=0.4)
cmp = VGroup(
Text("exacto: 11,9 años", font=FONT, font_size=42, color=GRIS),
Text("regla: 12 años", font=FONT, font_size=42, weight=BOLD, color=VERDE),
).arrange(DOWN, buff=0.3, aligned_edge=LEFT).move_to(UP * 0.4)
ok = self.fit(Text("es aproximada, pero se clava", font=FONT, font_size=42,
weight=BOLD, color=WHITE), 8.2).next_to(cmp, DOWN, buff=0.6)
b.play(FadeIn(cmp[0]), run_time=0.5)
b.play(FadeIn(cmp[1]), run_time=0.5)
b.play(FadeIn(ok, shift=UP * 0.15), run_time=0.6)
with self.beat(10) as b:
b.play(FadeOut(VGroup(cmp, ok)), run_time=0.35)
cta = self.fit(Text("guardate esta cuenta", font=FONT, font_size=60,
weight=BOLD, color=AMBAR), 8.0).move_to(UP * 0.4)
b.play(Write(cta), run_time=0.9)
b.play(Circumscribe(cta, color=AMBAR, buff=0.3, stroke_width=7), run_time=1.0)
self.finish()
|