diff options
Diffstat (limited to 'scenes/v5_japones.py')
| -rw-r--r-- | scenes/v5_japones.py | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/scenes/v5_japones.py b/scenes/v5_japones.py index 9b617d5..7ebff4b 100644 --- a/scenes/v5_japones.py +++ b/scenes/v5_japones.py @@ -4,10 +4,10 @@ sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from manim import * from tiktok import * -M = 0.6 # pendiente de las familias de rectas -XA, XB = -3.2, 3.7 # extremos de los segmentos -C_TENS, C_UNITS = [1.2, 1.8], [-1.2] # 21 -> rectas "/" -D_TENS, D_UNITS = [-1.2], [1.2, 1.8, 2.4] # 13 -> rectas "\" +M = 0.6 # slope of the line families +XA, XB = -3.2, 3.7 # segment ends +C_TENS, C_UNITS = [1.2, 1.8], [-1.2] # 21 -> "/" lines +D_TENS, D_UNITS = [-1.2], [1.2, 1.8, 2.4] # 13 -> "\" lines def pline(c): @@ -23,28 +23,28 @@ def cross(c, d): return np.array([x, M * x + c, 0]) -class Japones(TikTok): +class Japanese(TikTok): NAME = "japones" def construct(self): self.prepare() - chip = self.chip("Multiplicar sin tablas", VERDE) + chip = self.chip("Multiplicar sin tablas", C_GREEN) P = [pline(c) for c in C_TENS + C_UNITS] Q = [qline(d) for d in D_TENS + D_UNITS] for l in P: - l.set_stroke(AMBAR, 7) + l.set_stroke(AMBER, 7) for l in Q: - l.set_stroke(CELESTE, 7) + l.set_stroke(C_SKY, 7) - zonas = { + zones = { "izq": [cross(c, d) for c in C_TENS for d in D_TENS], "med": [cross(c, d) for c in C_TENS for d in D_UNITS] + [cross(c, d) for c in C_UNITS for d in D_TENS], "der": [cross(c, d) for c in C_UNITS for d in D_UNITS], } dots = {k: VGroup(*[Dot(p, radius=0.13, color=WHITE) for p in v]) - for k, v in zonas.items()} + for k, v in zones.items()} fig = VGroup(*P, *Q, *dots.values()) fig.scale(6.15 / fig.height).move_to(UP * 2.35) @@ -57,8 +57,8 @@ class Japones(TikTok): with self.beat(1) as b: op = MathTex(r"21 \times 13", color=WHITE).scale(2.6).move_to(UP * 0.6) - op[0][0:2].set_color(AMBAR) - op[0][3:5].set_color(CELESTE) + op[0][0:2].set_color(AMBER) + op[0][3:5].set_color(C_SKY) b.play(FadeOut(hook), run_time=0.3) b.play(Write(op), run_time=1.0) @@ -67,9 +67,9 @@ class Japones(TikTok): b.play(LaggedStart(*[Create(P[i]) for i in range(len(C_TENS))], lag_ratio=0.35), run_time=0.85) b.play(Create(P[len(C_TENS)]), run_time=0.5) - d2 = Text("2", font=FONT, font_size=44, weight=BOLD, color=AMBAR) + d2 = Text("2", font=FONT, font_size=44, weight=BOLD, color=AMBER) d2.move_to(P[0].get_end() + RIGHT * 0.45 + UP * 0.12) - d1 = Text("1", font=FONT, font_size=44, weight=BOLD, color=AMBAR) + d1 = Text("1", font=FONT, font_size=44, weight=BOLD, color=AMBER) d1.move_to(P[2].get_end() + RIGHT * 0.45 + UP * 0.12) b.play(FadeIn(d2), FadeIn(d1), run_time=0.4) @@ -77,9 +77,9 @@ class Japones(TikTok): b.play(Create(Q[0]), run_time=0.5) b.play(LaggedStart(*[Create(Q[i]) for i in range(1, len(Q))], lag_ratio=0.3), run_time=0.95) - e1 = Text("1", font=FONT, font_size=44, weight=BOLD, color=CELESTE) + e1 = Text("1", font=FONT, font_size=44, weight=BOLD, color=C_SKY) e1.move_to(Q[0].get_start() + LEFT * 0.45 + UP * 0.12) - e3 = Text("3", font=FONT, font_size=44, weight=BOLD, color=CELESTE) + e3 = Text("3", font=FONT, font_size=44, weight=BOLD, color=C_SKY) e3.move_to(Q[2].get_start() + LEFT * 0.45 + UP * 0.12) b.play(FadeIn(e1), FadeIn(e3), run_time=0.4) @@ -87,13 +87,13 @@ class Japones(TikTok): res = {} prev = [] - def zona(bt, key, col, valor, texto): + def zone(bt, key, col, valor, txt_m): box = SurroundingRectangle(dots[key], color=col, buff=0.34, corner_radius=0.3, stroke_width=7) bt.play(Create(box), run_time=0.5) bt.play(LaggedStart(*[FadeIn(dd, scale=0.4) for dd in dots[key]], lag_ratio=0.18), run_time=0.7) - lab = Text(texto, font=FONT, font_size=42, weight=BOLD, color=col) + lab = Text(txt_m, font=FONT, font_size=42, weight=BOLD, color=col) lab.next_to(box, DOWN, buff=0.28) self.fit(lab, 4.6) if lab.get_left()[0] < -3.9: @@ -109,19 +109,19 @@ class Japones(TikTok): return box, lab with self.beat(4) as b: - bz, lz = zona(b, "izq", VERDE, 2, "2 cruces") + bz, lz = zone(b, "izq", C_GREEN, 2, "2 cruces") with self.beat(5) as b: - bm, lm = zona(b, "med", ROSA, 7, "6 + 1 = 7") + bm, lm = zone(b, "med", C_PINK, 7, "6 + 1 = 7") with self.beat(6) as b: - bd, ld = zona(b, "der", CELESTE, 3, "3 cruces") + bd, ld = zone(b, "der", C_SKY, 3, "3 cruces") with self.beat(7) as b: nums = VGroup( - Text("2", font=FONT, font_size=96, weight=BOLD, color=VERDE), - Text("7", font=FONT, font_size=96, weight=BOLD, color=ROSA), - Text("3", font=FONT, font_size=96, weight=BOLD, color=CELESTE), + Text("2", font=FONT, font_size=96, weight=BOLD, color=C_GREEN), + Text("7", font=FONT, font_size=96, weight=BOLD, color=C_PINK), + Text("3", font=FONT, font_size=96, weight=BOLD, color=C_SKY), ).arrange(RIGHT, buff=0.55).move_to(DOWN * 1.35) b.play(FadeOut(VGroup(ld, op)), run_time=0.3) b.play(TransformFromCopy(dots["izq"], nums[0]), @@ -134,10 +134,10 @@ class Japones(TikTok): with self.beat(8) as b: b.play(FadeOut(VGroup(*P, *Q, *dots.values(), bz, bm, bd, digs, nums)), run_time=0.5) - check = MathTex(r"21 \times 13 = 273", color=VERDE).scale(1.9).move_to(UP * 2.4) + check = MathTex(r"21 \times 13 = 273", color=C_GREEN).scale(1.9).move_to(UP * 2.4) b.play(total.animate.move_to(UP * 0.2).scale(0.9), run_time=0.5) b.play(Write(check), run_time=0.9) - b.play(Flash(check, color=VERDE, line_length=0.6, num_lines=20, + b.play(Flash(check, color=C_GREEN, line_length=0.6, num_lines=20, flash_radius=2.4), run_time=0.8) with self.beat(9) as b: @@ -146,15 +146,15 @@ class Japones(TikTok): self.fit(Text("¿una zona da más de 9?", font=FONT, font_size=46, weight=BOLD, color=WHITE), 8.0), self.fit(Text("llevás una a la de al lado", font=FONT, font_size=46, - weight=BOLD, color=AMBAR), 8.0), + weight=BOLD, color=AMBER), 8.0), ).arrange(DOWN, buff=0.35).move_to(DOWN * 0.6) b.play(FadeIn(tip[0], shift=UP * 0.15), run_time=0.6) b.play(FadeIn(tip[1], shift=UP * 0.15), run_time=0.6) with self.beat(10) as b: - cta = self.fit(Text("guardalo para la tarea", font=FONT, font_size=60, - weight=BOLD, color=AMBAR), 8.0).move_to(DOWN * 2.6) - b.play(Write(cta), run_time=0.9) - b.play(Circumscribe(cta, color=AMBAR, buff=0.3, stroke_width=7), run_time=1.0) + count_txt = self.fit(Text("guardalo para la tarea", font=FONT, font_size=60, + weight=BOLD, color=AMBER), 8.0).move_to(DOWN * 2.6) + b.play(Write(count_txt), run_time=0.9) + b.play(Circumscribe(count_txt, color=AMBER, buff=0.3, stroke_width=7), run_time=1.0) self.finish() |