-
Notifications
You must be signed in to change notification settings - Fork 13
/
cerradura.py
117 lines (109 loc) · 3.95 KB
/
cerradura.py
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
from manimlib.imports import *
##################################
#### CERRADURA DE UN CONJUNTO ####
##################################
class Cerradura(Scene):
def construct(self):
title = TextMobject("""Cerradura""")
defi = TextMobject(
"""Definimos la""",
""" cerradura""",
""" de un conjunto""",
""" $A$""",
""" como """,
)
defi.set_color_by_tex_to_color_map({"""cerradura""": PURPLE, """$A$""": YELLOW})
defi2 = TextMobject(
""" $\\bar{A}$""",
"""=""",
"""$cl(A)$""",
""":=""",
"""$A$""",
"""$\\cup$""",
"""$Fr(A)$""",
).next_to(defi, DOWN)
defi2.set_color_by_tex_to_color_map(
{
"""$\\bar{A}$""": PURPLE,
"""$cl(A)$""": PURPLE,
"""$A$""": YELLOW,
"""Fr(A)""": RED,
}
)
conjuntoA = SVGMobject(
"Topologia_SVGs/cjtoA.svg",
color=RED,
fill_color=YELLOW,
fill_opacity=1.2,
).scale(2)
nameA = TexMobject("A").next_to(conjuntoA, DOWN)
note = (
TextMobject(
"""*Recuerda que el conjunto puede contener elementos de su frontera, es decir, \n
el conjunto no es necesariamente igual a su interior."""
)
.scale(0.55)
.to_edge(DOWN)
)
group = VGroup(conjuntoA, defi, defi2, nameA, note)
group2 = VGroup(defi, defi2)
text1 = TextMobject("""Veamos algunas propiedades sobre la""", """ cerradura""")
text1.set_color_by_tex_to_color_map({"""cerradura""": PURPLE})
text2 = TexMobject(r"cl(A\cup B)", r"=", r"cl(A)", r"\cup", r"cl(B)")
text2.set_color_by_tex_to_color_map({"cl(A)": YELLOW, "cl(B)": BLUE})
conjuntoB = (
SVGMobject("Topologia_SVGs/cjtoB.svg", color=BLUE, fill_color=BLUE)
.shift(1.5 * RIGHT)
.scale(2)
)
conjuntoA1 = conjuntoA.copy()
conjuntoA1.set_color(YELLOW).shift(1.5 * LEFT)
A = TexMobject("A").next_to(conjuntoA1, DOWN)
B = TexMobject("B").next_to(conjuntoB, DOWN)
names = VGroup(A, B)
conjuntos = VGroup(conjuntoA1, conjuntoB)
conjuntoA2 = (
SVGMobject("Topologia_SVGs/cjtoA.svg", color=WHITE, fill_color=WHITE)
.shift(2.5 * LEFT)
.scale(2)
)
conjuntoB2 = (
SVGMobject("Topologia_SVGs/cjtoB.svg", color=WHITE, fill_color=WHITE)
.shift(2.5 * RIGHT)
.scale(2)
)
conjuntos2 = VGroup(conjuntoA2, conjuntoB2)
text3 = TextMobject("""Intenta demostrar que:""")
prop1 = TexMobject(
r"x\in cl(A) \Leftrightarrow \forall \varepsilon>0,\ B_{\varepsilon}\cap A\neq\emptyset"
).next_to(text3, DOWN)
# Secuencia de la animación
self.play(Write(title.scale(1.5)))
self.wait()
self.play(FadeOut(title), run_time=0.5)
self.play(Write(defi))
self.play(Write(defi2))
self.wait(2)
self.play(ApplyMethod(group2.to_edge, UP))
#
self.play(DrawBorderThenFill(conjuntoA), rate_func=linear)
self.play(Write(nameA))
self.wait(1)
self.play(Write(note), run_time=6)
self.wait(1)
self.play(FadeOut(group))
#
self.play(Write(text1))
self.wait(2)
self.play(ReplacementTransform(text1, text2))
self.play(ApplyMethod(text2.to_edge, UP))
self.play(DrawBorderThenFill(conjuntos2), Write(names))
self.wait()
self.play(ReplacementTransform(conjuntos2, conjuntos))
self.wait(9)
self.play(FadeOut(conjuntos), FadeOut(text2), FadeOut(names))
#
self.play(Write(text3))
self.play(Write(prop1))
self.wait(14)
self.play(FadeOut(text3), FadeOut(prop1))