mirror of
https://github.com/3b1b/manim.git
synced 2025-04-13 09:47:07 +00:00
Rename TexMobject -> Tex and TextMobject -> TexText
This commit is contained in:
parent
3bd56bff07
commit
f91c81dd6a
16 changed files with 97 additions and 97 deletions
|
@ -10,8 +10,8 @@ from manimlib.imports import *
|
||||||
|
|
||||||
class OpeningManimExample(Scene):
|
class OpeningManimExample(Scene):
|
||||||
def construct(self):
|
def construct(self):
|
||||||
title = TextMobject("This is some \\LaTeX")
|
title = TexText("This is some \\LaTeX")
|
||||||
basel = TexMobject(
|
basel = Tex(
|
||||||
"\\sum_{n=1}^\\infty "
|
"\\sum_{n=1}^\\infty "
|
||||||
"\\frac{1}{n^2} = \\frac{\\pi^2}{6}"
|
"\\frac{1}{n^2} = \\frac{\\pi^2}{6}"
|
||||||
)
|
)
|
||||||
|
@ -111,12 +111,12 @@ class TextExample(Scene):
|
||||||
text = Text("Here is a text", font="Consolas", font_size=90)
|
text = Text("Here is a text", font="Consolas", font_size=90)
|
||||||
difference = Text(
|
difference = Text(
|
||||||
"""
|
"""
|
||||||
The most important difference between Text and TextMobject is that\n
|
The most important difference between Text and TexText is that\n
|
||||||
you can change the font more easily, but can't use the LaTeX gramma
|
you can change the font more easily, but can't use the LaTeX grammar
|
||||||
""",
|
""",
|
||||||
font="Arial", font_size=24,
|
font="Arial", font_size=24,
|
||||||
# t2c is a dict that you can choose color for different text
|
# t2c is a dict that you can choose color for different text
|
||||||
t2c={"Text": BLUE, "TextMobject": BLUE, "LaTeX": ORANGE}
|
t2c={"Text": BLUE, "TexText": BLUE, "LaTeX": ORANGE}
|
||||||
)
|
)
|
||||||
VGroup(text, difference).arrange(DOWN, buff=1)
|
VGroup(text, difference).arrange(DOWN, buff=1)
|
||||||
self.play(Write(text))
|
self.play(Write(text))
|
||||||
|
@ -175,18 +175,18 @@ class TexTransformExample(Scene):
|
||||||
lines = VGroup(
|
lines = VGroup(
|
||||||
# Surrounding substrings with double braces
|
# Surrounding substrings with double braces
|
||||||
# will ensure that those parts are separated
|
# will ensure that those parts are separated
|
||||||
# out in the TexMobject. For example, here the
|
# out in the Tex. For example, here the
|
||||||
# TexMobject will have 5 submobjects, corresponding
|
# Tex will have 5 submobjects, corresponding
|
||||||
# to the strings [A^2, +, B^2, =, C^2]
|
# to the strings [A^2, +, B^2, =, C^2]
|
||||||
TexMobject("{{A^2}} + {{B^2}} = {{C^2}}"),
|
Tex("{{A^2}} + {{B^2}} = {{C^2}}"),
|
||||||
TexMobject("{{A^2}} = {{C^2}} - {{B^2}}"),
|
Tex("{{A^2}} = {{C^2}} - {{B^2}}"),
|
||||||
# Alternatively, you can pass in the keyword argument
|
# Alternatively, you can pass in the keyword argument
|
||||||
# isolate with a list of strings that should be out as
|
# isolate with a list of strings that should be out as
|
||||||
# their own submobject. So both lines below are equivalent
|
# their own submobject. So both lines below are equivalent
|
||||||
# to what you'd get by wrapping every instance of "B", "C"
|
# to what you'd get by wrapping every instance of "B", "C"
|
||||||
# "=", "(" and ")" with double braces
|
# "=", "(" and ")" with double braces
|
||||||
TexMobject("{{A^2}} = (C + B)(C - B)", **kw),
|
Tex("{{A^2}} = (C + B)(C - B)", **kw),
|
||||||
TexMobject("A = \\sqrt{(C + B)(C - B)}", **kw)
|
Tex("A = \\sqrt{(C + B)(C - B)}", **kw)
|
||||||
)
|
)
|
||||||
lines.arrange(DOWN, buff=LARGE_BUFF)
|
lines.arrange(DOWN, buff=LARGE_BUFF)
|
||||||
for line in lines:
|
for line in lines:
|
||||||
|
@ -258,8 +258,8 @@ class TexTransformExample(Scene):
|
||||||
# those of a target, regardless of the submobject hierarchy in
|
# those of a target, regardless of the submobject hierarchy in
|
||||||
# each one, according to whether those pieces have the same
|
# each one, according to whether those pieces have the same
|
||||||
# shape (as best it can).
|
# shape (as best it can).
|
||||||
source = TextMobject("the morse code")
|
source = TexText("the morse code")
|
||||||
target = TextMobject("here come dots")
|
target = TexText("here come dots")
|
||||||
|
|
||||||
self.play(Write(source))
|
self.play(Write(source))
|
||||||
self.wait()
|
self.wait()
|
||||||
|
|
10
logo/logo.py
10
logo/logo.py
|
@ -60,10 +60,10 @@ class Thumbnail(GraphScene):
|
||||||
triangle.scale(0.1)
|
triangle.scale(0.1)
|
||||||
|
|
||||||
#
|
#
|
||||||
x_label_p1 = TexMobject("a")
|
x_label_p1 = Tex("a")
|
||||||
output_label_p1 = TexMobject("f(a)")
|
output_label_p1 = Tex("f(a)")
|
||||||
x_label_p2 = TexMobject("b")
|
x_label_p2 = Tex("b")
|
||||||
output_label_p2 = TexMobject("f(b)")
|
output_label_p2 = Tex("f(b)")
|
||||||
v_line_p1 = get_v_line(input_tracker_p1)
|
v_line_p1 = get_v_line(input_tracker_p1)
|
||||||
v_line_p2 = get_v_line(input_tracker_p2)
|
v_line_p2 = get_v_line(input_tracker_p2)
|
||||||
h_line_p1 = get_h_line(input_tracker_p1)
|
h_line_p1 = get_h_line(input_tracker_p1)
|
||||||
|
@ -170,7 +170,7 @@ class Thumbnail(GraphScene):
|
||||||
# adding manim
|
# adding manim
|
||||||
picture = Group(*self.mobjects)
|
picture = Group(*self.mobjects)
|
||||||
picture.scale(0.6).to_edge(LEFT, buff=SMALL_BUFF)
|
picture.scale(0.6).to_edge(LEFT, buff=SMALL_BUFF)
|
||||||
manim = TextMobject("Manim").set_height(1.5) \
|
manim = TexText("Manim").set_height(1.5) \
|
||||||
.next_to(picture, RIGHT) \
|
.next_to(picture, RIGHT) \
|
||||||
.shift(DOWN * 0.7)
|
.shift(DOWN * 0.7)
|
||||||
self.add(manim)
|
self.add(manim)
|
||||||
|
|
|
@ -8,7 +8,7 @@ from manimlib.mobject.mobject import Mobject
|
||||||
from manimlib.mobject.mobject import Group
|
from manimlib.mobject.mobject import Group
|
||||||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
from manimlib.mobject.types.vectorized_mobject import VGroup
|
||||||
from manimlib.mobject.types.vectorized_mobject import VMobject
|
from manimlib.mobject.types.vectorized_mobject import VMobject
|
||||||
from manimlib.mobject.svg.tex_mobject import TexMobject
|
from manimlib.mobject.svg.tex_mobject import Tex
|
||||||
from manimlib.utils.config_ops import digest_config
|
from manimlib.utils.config_ops import digest_config
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ class TransformMatchingShapes(TransformMatchingParts):
|
||||||
|
|
||||||
class TransformMatchingTex(TransformMatchingParts):
|
class TransformMatchingTex(TransformMatchingParts):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"mobject_type": TexMobject,
|
"mobject_type": Tex,
|
||||||
"group_type": VGroup,
|
"group_type": VGroup,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ from manimlib.mobject.functions import ParametricCurve
|
||||||
from manimlib.mobject.geometry import Arrow
|
from manimlib.mobject.geometry import Arrow
|
||||||
from manimlib.mobject.geometry import Line
|
from manimlib.mobject.geometry import Line
|
||||||
from manimlib.mobject.number_line import NumberLine
|
from manimlib.mobject.number_line import NumberLine
|
||||||
from manimlib.mobject.svg.tex_mobject import TexMobject
|
from manimlib.mobject.svg.tex_mobject import Tex
|
||||||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
from manimlib.mobject.types.vectorized_mobject import VGroup
|
||||||
from manimlib.utils.config_ops import merge_dicts_recursively
|
from manimlib.utils.config_ops import merge_dicts_recursively
|
||||||
from manimlib.utils.simple_functions import binary_search
|
from manimlib.utils.simple_functions import binary_search
|
||||||
|
@ -69,7 +69,7 @@ class CoordinateSystem():
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_axis_label(self, label_tex, axis, edge, direction, buff=MED_SMALL_BUFF):
|
def get_axis_label(self, label_tex, axis, edge, direction, buff=MED_SMALL_BUFF):
|
||||||
label = TexMobject(label_tex)
|
label = Tex(label_tex)
|
||||||
label.next_to(
|
label.next_to(
|
||||||
axis.get_edge_center(edge), direction,
|
axis.get_edge_center(edge), direction,
|
||||||
buff=buff
|
buff=buff
|
||||||
|
|
|
@ -5,8 +5,8 @@ from manimlib.constants import *
|
||||||
from manimlib.mobject.numbers import DecimalNumber
|
from manimlib.mobject.numbers import DecimalNumber
|
||||||
from manimlib.mobject.numbers import Integer
|
from manimlib.mobject.numbers import Integer
|
||||||
from manimlib.mobject.shape_matchers import BackgroundRectangle
|
from manimlib.mobject.shape_matchers import BackgroundRectangle
|
||||||
from manimlib.mobject.svg.tex_mobject import TexMobject
|
from manimlib.mobject.svg.tex_mobject import Tex
|
||||||
from manimlib.mobject.svg.tex_mobject import TextMobject
|
from manimlib.mobject.svg.tex_mobject import TexText
|
||||||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
from manimlib.mobject.types.vectorized_mobject import VGroup
|
||||||
from manimlib.mobject.types.vectorized_mobject import VMobject
|
from manimlib.mobject.types.vectorized_mobject import VMobject
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ def matrix_to_tex_string(matrix):
|
||||||
|
|
||||||
|
|
||||||
def matrix_to_mobject(matrix):
|
def matrix_to_mobject(matrix):
|
||||||
return TexMobject(matrix_to_tex_string(matrix))
|
return Tex(matrix_to_tex_string(matrix))
|
||||||
|
|
||||||
|
|
||||||
def vector_coordinate_label(vector_mob, integer_labels=True,
|
def vector_coordinate_label(vector_mob, integer_labels=True,
|
||||||
|
@ -61,7 +61,7 @@ class Matrix(VMobject):
|
||||||
"bracket_v_buff": MED_SMALL_BUFF,
|
"bracket_v_buff": MED_SMALL_BUFF,
|
||||||
"add_background_rectangles_to_entries": False,
|
"add_background_rectangles_to_entries": False,
|
||||||
"include_background_rectangle": False,
|
"include_background_rectangle": False,
|
||||||
"element_to_mobject": TexMobject,
|
"element_to_mobject": Tex,
|
||||||
"element_to_mobject_config": {},
|
"element_to_mobject_config": {},
|
||||||
"element_alignment_corner": DR,
|
"element_alignment_corner": DR,
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ class Matrix(VMobject):
|
||||||
|
|
||||||
def add_brackets(self):
|
def add_brackets(self):
|
||||||
height = self.matrix.shape[0]
|
height = self.matrix.shape[0]
|
||||||
bracket_pair = TexMobject("".join([
|
bracket_pair = Tex("".join([
|
||||||
"\\left[",
|
"\\left[",
|
||||||
"\\begin{array}{c}",
|
"\\begin{array}{c}",
|
||||||
*height * ["\\quad \\\\"],
|
*height * ["\\quad \\\\"],
|
||||||
|
@ -173,22 +173,22 @@ class MobjectMatrix(Matrix):
|
||||||
|
|
||||||
|
|
||||||
def get_det_text(matrix, determinant=None, background_rect=False, initial_scale_factor=2):
|
def get_det_text(matrix, determinant=None, background_rect=False, initial_scale_factor=2):
|
||||||
parens = TexMobject("(", ")")
|
parens = Tex("(", ")")
|
||||||
parens.scale(initial_scale_factor)
|
parens.scale(initial_scale_factor)
|
||||||
parens.stretch_to_fit_height(matrix.get_height())
|
parens.stretch_to_fit_height(matrix.get_height())
|
||||||
l_paren, r_paren = parens.split()
|
l_paren, r_paren = parens.split()
|
||||||
l_paren.next_to(matrix, LEFT, buff=0.1)
|
l_paren.next_to(matrix, LEFT, buff=0.1)
|
||||||
r_paren.next_to(matrix, RIGHT, buff=0.1)
|
r_paren.next_to(matrix, RIGHT, buff=0.1)
|
||||||
det = TextMobject("det")
|
det = TexText("det")
|
||||||
det.scale(initial_scale_factor)
|
det.scale(initial_scale_factor)
|
||||||
det.next_to(l_paren, LEFT, buff=0.1)
|
det.next_to(l_paren, LEFT, buff=0.1)
|
||||||
if background_rect:
|
if background_rect:
|
||||||
det.add_background_rectangle()
|
det.add_background_rectangle()
|
||||||
det_text = VGroup(det, l_paren, r_paren)
|
det_text = VGroup(det, l_paren, r_paren)
|
||||||
if determinant is not None:
|
if determinant is not None:
|
||||||
eq = TexMobject("=")
|
eq = Tex("=")
|
||||||
eq.next_to(r_paren, RIGHT, buff=0.1)
|
eq.next_to(r_paren, RIGHT, buff=0.1)
|
||||||
result = TexMobject(str(determinant))
|
result = Tex(str(determinant))
|
||||||
result.next_to(eq, RIGHT, buff=0.2)
|
result.next_to(eq, RIGHT, buff=0.2)
|
||||||
det_text.add(eq, result)
|
det_text.add(eq, result)
|
||||||
return det_text
|
return det_text
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from manimlib.constants import *
|
from manimlib.constants import *
|
||||||
from manimlib.mobject.svg.tex_mobject import SingleStringTexMobject
|
from manimlib.mobject.svg.tex_mobject import SingleStringTex
|
||||||
from manimlib.mobject.svg.tex_mobject import tex_string_to_mob_map
|
from manimlib.mobject.svg.tex_mobject import tex_string_to_mob_map
|
||||||
from manimlib.mobject.svg.tex_mobject import SCALE_FACTOR_PER_FONT_POINT
|
from manimlib.mobject.svg.tex_mobject import SCALE_FACTOR_PER_FONT_POINT
|
||||||
from manimlib.mobject.types.vectorized_mobject import VMobject
|
from manimlib.mobject.types.vectorized_mobject import VMobject
|
||||||
|
@ -89,7 +89,7 @@ class DecimalNumber(VMobject):
|
||||||
return self.data["font_size"][0]
|
return self.data["font_size"][0]
|
||||||
|
|
||||||
def string_to_mob(self, tex_string):
|
def string_to_mob(self, tex_string):
|
||||||
# Could just call SingleStringTexMobject, and there is
|
# Could just call SingleStringTex, and there is
|
||||||
# some code repetition here by looking to the same cache,
|
# some code repetition here by looking to the same cache,
|
||||||
# but it keeps things from initializing a new object
|
# but it keeps things from initializing a new object
|
||||||
# more than is necessary
|
# more than is necessary
|
||||||
|
@ -98,7 +98,7 @@ class DecimalNumber(VMobject):
|
||||||
result.scale(self.get_font_size() * SCALE_FACTOR_PER_FONT_POINT)
|
result.scale(self.get_font_size() * SCALE_FACTOR_PER_FONT_POINT)
|
||||||
return result
|
return result
|
||||||
else:
|
else:
|
||||||
return SingleStringTexMobject(tex_string, font_size=self.get_font_size())
|
return SingleStringTex(tex_string, font_size=self.get_font_size())
|
||||||
|
|
||||||
def get_formatter(self, **kwargs):
|
def get_formatter(self, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -3,8 +3,8 @@ from manimlib.mobject.geometry import Line
|
||||||
from manimlib.mobject.geometry import Rectangle
|
from manimlib.mobject.geometry import Rectangle
|
||||||
from manimlib.mobject.mobject import Mobject
|
from manimlib.mobject.mobject import Mobject
|
||||||
from manimlib.mobject.svg.brace import Brace
|
from manimlib.mobject.svg.brace import Brace
|
||||||
from manimlib.mobject.svg.tex_mobject import TexMobject
|
from manimlib.mobject.svg.tex_mobject import Tex
|
||||||
from manimlib.mobject.svg.tex_mobject import TextMobject
|
from manimlib.mobject.svg.tex_mobject import TexText
|
||||||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
from manimlib.mobject.types.vectorized_mobject import VGroup
|
||||||
from manimlib.utils.color import color_gradient
|
from manimlib.utils.color import color_gradient
|
||||||
from manimlib.utils.iterables import listify
|
from manimlib.utils.iterables import listify
|
||||||
|
@ -26,7 +26,7 @@ class SampleSpace(Rectangle):
|
||||||
|
|
||||||
def add_title(self, title="Sample space", buff=MED_SMALL_BUFF):
|
def add_title(self, title="Sample space", buff=MED_SMALL_BUFF):
|
||||||
# TODO, should this really exist in SampleSpaceScene
|
# TODO, should this really exist in SampleSpaceScene
|
||||||
title_mob = TextMobject(title)
|
title_mob = TexText(title)
|
||||||
if title_mob.get_width() > self.get_width():
|
if title_mob.get_width() > self.get_width():
|
||||||
title_mob.set_width(self.get_width())
|
title_mob.set_width(self.get_width())
|
||||||
title_mob.next_to(self, UP, buff=buff)
|
title_mob.next_to(self, UP, buff=buff)
|
||||||
|
@ -97,7 +97,7 @@ class SampleSpace(Rectangle):
|
||||||
if isinstance(label, Mobject):
|
if isinstance(label, Mobject):
|
||||||
label_mob = label
|
label_mob = label
|
||||||
else:
|
else:
|
||||||
label_mob = TexMobject(label)
|
label_mob = Tex(label)
|
||||||
label_mob.scale(self.default_label_scale_val)
|
label_mob.scale(self.default_label_scale_val)
|
||||||
label_mob.next_to(brace, direction, buff)
|
label_mob.next_to(brace, direction, buff)
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ class BarChart(VGroup):
|
||||||
if self.label_y_axis:
|
if self.label_y_axis:
|
||||||
labels = VGroup()
|
labels = VGroup()
|
||||||
for tick, value in zip(ticks, values):
|
for tick, value in zip(ticks, values):
|
||||||
label = TexMobject(str(np.round(value, 2)))
|
label = Tex(str(np.round(value, 2)))
|
||||||
label.set_height(self.y_axis_label_height)
|
label.set_height(self.y_axis_label_height)
|
||||||
label.next_to(tick, LEFT, SMALL_BUFF)
|
label.next_to(tick, LEFT, SMALL_BUFF)
|
||||||
labels.add(label)
|
labels.add(label)
|
||||||
|
@ -211,7 +211,7 @@ class BarChart(VGroup):
|
||||||
|
|
||||||
bar_labels = VGroup()
|
bar_labels = VGroup()
|
||||||
for bar, name in zip(bars, self.bar_names):
|
for bar, name in zip(bars, self.bar_names):
|
||||||
label = TexMobject(str(name))
|
label = Tex(str(name))
|
||||||
label.scale(self.bar_label_scale_val)
|
label.scale(self.bar_label_scale_val)
|
||||||
label.next_to(bar, DOWN, SMALL_BUFF)
|
label.next_to(bar, DOWN, SMALL_BUFF)
|
||||||
bar_labels.add(label)
|
bar_labels.add(label)
|
||||||
|
|
|
@ -4,14 +4,14 @@ from manimlib.animation.composition import AnimationGroup
|
||||||
from manimlib.constants import *
|
from manimlib.constants import *
|
||||||
from manimlib.animation.fading import FadeIn
|
from manimlib.animation.fading import FadeIn
|
||||||
from manimlib.animation.growing import GrowFromCenter
|
from manimlib.animation.growing import GrowFromCenter
|
||||||
from manimlib.mobject.svg.tex_mobject import TexMobject
|
from manimlib.mobject.svg.tex_mobject import Tex
|
||||||
from manimlib.mobject.svg.tex_mobject import TextMobject
|
from manimlib.mobject.svg.tex_mobject import TexText
|
||||||
from manimlib.mobject.types.vectorized_mobject import VMobject
|
from manimlib.mobject.types.vectorized_mobject import VMobject
|
||||||
from manimlib.utils.config_ops import digest_config
|
from manimlib.utils.config_ops import digest_config
|
||||||
from manimlib.utils.space_ops import get_norm
|
from manimlib.utils.space_ops import get_norm
|
||||||
|
|
||||||
|
|
||||||
class Brace(TexMobject):
|
class Brace(Tex):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"buff": 0.2,
|
"buff": 0.2,
|
||||||
"width_multiplier": 2,
|
"width_multiplier": 2,
|
||||||
|
@ -34,7 +34,7 @@ class Brace(TexMobject):
|
||||||
self.min_num_quads, self.max_num_quads
|
self.min_num_quads, self.max_num_quads
|
||||||
)
|
)
|
||||||
tex_string = "\\underbrace{%s}" % (num_quads * "\\qquad")
|
tex_string = "\\underbrace{%s}" % (num_quads * "\\qquad")
|
||||||
TexMobject.__init__(self, tex_string, **kwargs)
|
Tex.__init__(self, tex_string, **kwargs)
|
||||||
self.tip_point_index = np.argmin(self.get_all_points()[:, 1])
|
self.tip_point_index = np.argmin(self.get_all_points()[:, 1])
|
||||||
self.stretch_to_fit_width(target_width)
|
self.stretch_to_fit_width(target_width)
|
||||||
self.shift(left - self.get_corner(UP + LEFT) + self.buff * DOWN)
|
self.shift(left - self.get_corner(UP + LEFT) + self.buff * DOWN)
|
||||||
|
@ -56,12 +56,12 @@ class Brace(TexMobject):
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def get_text(self, *text, **kwargs):
|
def get_text(self, *text, **kwargs):
|
||||||
text_mob = TextMobject(*text)
|
text_mob = TexText(*text)
|
||||||
self.put_at_tip(text_mob, **kwargs)
|
self.put_at_tip(text_mob, **kwargs)
|
||||||
return text_mob
|
return text_mob
|
||||||
|
|
||||||
def get_tex(self, *tex, **kwargs):
|
def get_tex(self, *tex, **kwargs):
|
||||||
tex_mob = TexMobject(*tex)
|
tex_mob = Tex(*tex)
|
||||||
self.put_at_tip(tex_mob, **kwargs)
|
self.put_at_tip(tex_mob, **kwargs)
|
||||||
return tex_mob
|
return tex_mob
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ class Brace(TexMobject):
|
||||||
|
|
||||||
class BraceLabel(VMobject):
|
class BraceLabel(VMobject):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"label_constructor": TexMobject,
|
"label_constructor": Tex,
|
||||||
"label_scale": 1,
|
"label_scale": 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,5 +135,5 @@ class BraceLabel(VMobject):
|
||||||
|
|
||||||
class BraceText(BraceLabel):
|
class BraceText(BraceLabel):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"label_constructor": TextMobject
|
"label_constructor": TexText
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,8 @@ from manimlib.mobject.geometry import Rectangle
|
||||||
from manimlib.mobject.geometry import Square
|
from manimlib.mobject.geometry import Square
|
||||||
from manimlib.mobject.mobject import Mobject
|
from manimlib.mobject.mobject import Mobject
|
||||||
from manimlib.mobject.svg.svg_mobject import SVGMobject
|
from manimlib.mobject.svg.svg_mobject import SVGMobject
|
||||||
from manimlib.mobject.svg.tex_mobject import TexMobject
|
from manimlib.mobject.svg.tex_mobject import Tex
|
||||||
from manimlib.mobject.svg.tex_mobject import TextMobject
|
from manimlib.mobject.svg.tex_mobject import TexText
|
||||||
from manimlib.mobject.three_dimensions import Cube
|
from manimlib.mobject.three_dimensions import Cube
|
||||||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
from manimlib.mobject.types.vectorized_mobject import VGroup
|
||||||
from manimlib.mobject.types.vectorized_mobject import VMobject
|
from manimlib.mobject.types.vectorized_mobject import VMobject
|
||||||
|
@ -21,7 +21,7 @@ from manimlib.utils.space_ops import complex_to_R3
|
||||||
from manimlib.utils.space_ops import rotate_vector
|
from manimlib.utils.space_ops import rotate_vector
|
||||||
|
|
||||||
|
|
||||||
class Checkmark(TextMobject):
|
class Checkmark(TexText):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"color": GREEN
|
"color": GREEN
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ class Checkmark(TextMobject):
|
||||||
super().__init__("\\ding{51}")
|
super().__init__("\\ding{51}")
|
||||||
|
|
||||||
|
|
||||||
class Exmark(TextMobject):
|
class Exmark(TexText):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"color": RED
|
"color": RED
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ class Speedometer(VMobject):
|
||||||
for index, angle in enumerate(tick_angle_range):
|
for index, angle in enumerate(tick_angle_range):
|
||||||
vect = rotate_vector(RIGHT, angle)
|
vect = rotate_vector(RIGHT, angle)
|
||||||
tick = Line((1 - self.tick_length) * vect, vect)
|
tick = Line((1 - self.tick_length) * vect, vect)
|
||||||
label = TexMobject(str(10 * index))
|
label = Tex(str(10 * index))
|
||||||
label.set_height(self.tick_length)
|
label.set_height(self.tick_length)
|
||||||
label.shift((1 + self.tick_length) * vect)
|
label.shift((1 + self.tick_length) * vect)
|
||||||
self.add(tick, label)
|
self.add(tick, label)
|
||||||
|
@ -365,7 +365,7 @@ class Bubble(SVGMobject):
|
||||||
return self.content
|
return self.content
|
||||||
|
|
||||||
def write(self, *text):
|
def write(self, *text):
|
||||||
self.add_content(TextMobject(*text))
|
self.add_content(TexText(*text))
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def resize_to_content(self):
|
def resize_to_content(self):
|
||||||
|
|
|
@ -20,7 +20,7 @@ SCALE_FACTOR_PER_FONT_POINT = 0.001
|
||||||
tex_string_to_mob_map = {}
|
tex_string_to_mob_map = {}
|
||||||
|
|
||||||
|
|
||||||
class SingleStringTexMobject(VMobject):
|
class SingleStringTex(VMobject):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"fill_opacity": 1.0,
|
"fill_opacity": 1.0,
|
||||||
"stroke_width": 0,
|
"stroke_width": 0,
|
||||||
|
@ -131,7 +131,7 @@ class SingleStringTexMobject(VMobject):
|
||||||
|
|
||||||
def balance_braces(self, tex):
|
def balance_braces(self, tex):
|
||||||
"""
|
"""
|
||||||
Makes TexMobject resiliant to unmatched { at start
|
Makes Tex resiliant to unmatched { at start
|
||||||
"""
|
"""
|
||||||
num_lefts, num_rights = [tex.count(char) for char in "{}"]
|
num_lefts, num_rights = [tex.count(char) for char in "{}"]
|
||||||
while num_rights > num_lefts:
|
while num_rights > num_lefts:
|
||||||
|
@ -150,7 +150,7 @@ class SingleStringTexMobject(VMobject):
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
||||||
class TexMobject(SingleStringTexMobject):
|
class Tex(SingleStringTex):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"arg_separator": " ",
|
"arg_separator": " ",
|
||||||
# Note, use of isolate is largely rendered
|
# Note, use of isolate is largely rendered
|
||||||
|
@ -205,7 +205,7 @@ class TexMobject(SingleStringTexMobject):
|
||||||
tex_string = tex_string.strip()
|
tex_string = tex_string.strip()
|
||||||
if len(tex_string) == 0:
|
if len(tex_string) == 0:
|
||||||
continue
|
continue
|
||||||
sub_tex_mob = SingleStringTexMobject(tex_string, **config)
|
sub_tex_mob = SingleStringTex(tex_string, **config)
|
||||||
num_submobs = len(sub_tex_mob)
|
num_submobs = len(sub_tex_mob)
|
||||||
if num_submobs == 0:
|
if num_submobs == 0:
|
||||||
continue
|
continue
|
||||||
|
@ -227,7 +227,7 @@ class TexMobject(SingleStringTexMobject):
|
||||||
return tex1 == tex2
|
return tex1 == tex2
|
||||||
|
|
||||||
return VGroup(*filter(
|
return VGroup(*filter(
|
||||||
lambda m: isinstance(m, SingleStringTexMobject) and test(tex, m.get_tex()),
|
lambda m: isinstance(m, SingleStringTex) and test(tex, m.get_tex()),
|
||||||
self.submobjects
|
self.submobjects
|
||||||
))
|
))
|
||||||
|
|
||||||
|
@ -271,14 +271,14 @@ class TexMobject(SingleStringTexMobject):
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
||||||
class TextMobject(TexMobject):
|
class TexText(Tex):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"math_mode": False,
|
"math_mode": False,
|
||||||
"arg_separator": "",
|
"arg_separator": "",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class BulletedList(TextMobject):
|
class BulletedList(TexText):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"buff": MED_LARGE_BUFF,
|
"buff": MED_LARGE_BUFF,
|
||||||
"dot_scale_factor": 2,
|
"dot_scale_factor": 2,
|
||||||
|
@ -287,9 +287,9 @@ class BulletedList(TextMobject):
|
||||||
|
|
||||||
def __init__(self, *items, **kwargs):
|
def __init__(self, *items, **kwargs):
|
||||||
line_separated_items = [s + "\\\\" for s in items]
|
line_separated_items = [s + "\\\\" for s in items]
|
||||||
TextMobject.__init__(self, *line_separated_items, **kwargs)
|
TexText.__init__(self, *line_separated_items, **kwargs)
|
||||||
for part in self:
|
for part in self:
|
||||||
dot = TexMobject("\\cdot").scale(self.dot_scale_factor)
|
dot = Tex("\\cdot").scale(self.dot_scale_factor)
|
||||||
dot.next_to(part[0], LEFT, SMALL_BUFF)
|
dot.next_to(part[0], LEFT, SMALL_BUFF)
|
||||||
part.add_to_back(dot)
|
part.add_to_back(dot)
|
||||||
self.arrange(
|
self.arrange(
|
||||||
|
@ -313,7 +313,7 @@ class BulletedList(TextMobject):
|
||||||
other_part.set_fill(opacity=opacity)
|
other_part.set_fill(opacity=opacity)
|
||||||
|
|
||||||
|
|
||||||
class TexMobjectFromPresetString(TexMobject):
|
class TexFromPresetString(Tex):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
# To be filled by subclasses
|
# To be filled by subclasses
|
||||||
"tex": None,
|
"tex": None,
|
||||||
|
@ -322,11 +322,11 @@ class TexMobjectFromPresetString(TexMobject):
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
digest_config(self, kwargs)
|
digest_config(self, kwargs)
|
||||||
TexMobject.__init__(self, self.tex, **kwargs)
|
Tex.__init__(self, self.tex, **kwargs)
|
||||||
self.set_color(self.color)
|
self.set_color(self.color)
|
||||||
|
|
||||||
|
|
||||||
class Title(TextMobject):
|
class Title(TexText):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"scale_factor": 1,
|
"scale_factor": 1,
|
||||||
"include_underline": True,
|
"include_underline": True,
|
||||||
|
@ -337,7 +337,7 @@ class Title(TextMobject):
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, *text_parts, **kwargs):
|
def __init__(self, *text_parts, **kwargs):
|
||||||
TextMobject.__init__(self, *text_parts, **kwargs)
|
TexText.__init__(self, *text_parts, **kwargs)
|
||||||
self.scale(self.scale_factor)
|
self.scale(self.scale_factor)
|
||||||
self.to_edge(UP)
|
self.to_edge(UP)
|
||||||
if self.include_underline:
|
if self.include_underline:
|
||||||
|
|
|
@ -2,7 +2,7 @@ import numpy as np
|
||||||
|
|
||||||
from manimlib.animation.animation import Animation
|
from manimlib.animation.animation import Animation
|
||||||
from manimlib.constants import *
|
from manimlib.constants import *
|
||||||
from manimlib.mobject.svg.tex_mobject import TexMobject
|
from manimlib.mobject.svg.tex_mobject import Tex
|
||||||
from manimlib.scene.scene import Scene
|
from manimlib.scene.scene import Scene
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ class RearrangeEquation(Scene):
|
||||||
"""
|
"""
|
||||||
num_start_terms = len(start_terms)
|
num_start_terms = len(start_terms)
|
||||||
all_mobs = np.array(
|
all_mobs = np.array(
|
||||||
TexMobject(start_terms).split() + TexMobject(end_terms).split())
|
Tex(start_terms).split() + Tex(end_terms).split())
|
||||||
all_terms = np.array(start_terms + end_terms)
|
all_terms = np.array(start_terms + end_terms)
|
||||||
for term in set(all_terms):
|
for term in set(all_terms):
|
||||||
matches = all_terms == term
|
matches = all_terms == term
|
||||||
|
@ -86,7 +86,7 @@ class FlipThroughSymbols(Animation):
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, tex_list, **kwargs):
|
def __init__(self, tex_list, **kwargs):
|
||||||
mobject = TexMobject(self.curr_tex).shift(start_center)
|
mobject = Tex(self.curr_tex).shift(start_center)
|
||||||
Animation.__init__(self, mobject, **kwargs)
|
Animation.__init__(self, mobject, **kwargs)
|
||||||
|
|
||||||
def interpolate_mobject(self, alpha):
|
def interpolate_mobject(self, alpha):
|
||||||
|
@ -94,7 +94,7 @@ class FlipThroughSymbols(Animation):
|
||||||
|
|
||||||
if new_tex != self.curr_tex:
|
if new_tex != self.curr_tex:
|
||||||
self.curr_tex = new_tex
|
self.curr_tex = new_tex
|
||||||
self.mobject = TexMobject(new_tex).shift(self.start_center)
|
self.mobject = Tex(new_tex).shift(self.start_center)
|
||||||
if not all(self.start_center == self.end_center):
|
if not all(self.start_center == self.end_center):
|
||||||
self.mobject.center().shift(
|
self.mobject.center().shift(
|
||||||
(1 - alpha) * self.start_center + alpha * self.end_center
|
(1 - alpha) * self.start_center + alpha * self.end_center
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from manimlib.constants import *
|
from manimlib.constants import *
|
||||||
from manimlib.mobject.numbers import Integer
|
from manimlib.mobject.numbers import Integer
|
||||||
from manimlib.mobject.svg.tex_mobject import TexMobject
|
from manimlib.mobject.svg.tex_mobject import Tex
|
||||||
from manimlib.mobject.types.vectorized_mobject import VMobject, VGroup
|
from manimlib.mobject.types.vectorized_mobject import VMobject, VGroup
|
||||||
from manimlib.scene.scene import Scene
|
from manimlib.scene.scene import Scene
|
||||||
from manimlib.utils.simple_functions import choose
|
from manimlib.utils.simple_functions import choose
|
||||||
|
@ -45,7 +45,7 @@ class CountingScene(Scene):
|
||||||
self.add(*mobjects)
|
self.add(*mobjects)
|
||||||
for mob, num in zip(mobjects, it.count(1)):
|
for mob, num in zip(mobjects, it.count(1)):
|
||||||
if display_numbers:
|
if display_numbers:
|
||||||
num_mob = TexMobject(str(num))
|
num_mob = Tex(str(num))
|
||||||
num_mob.center().shift(num_offset)
|
num_mob.center().shift(num_offset)
|
||||||
self.add(num_mob)
|
self.add(num_mob)
|
||||||
if mode == "highlight":
|
if mode == "highlight":
|
||||||
|
@ -74,7 +74,7 @@ class CountingScene(Scene):
|
||||||
raise Warning("Unknown mode")
|
raise Warning("Unknown mode")
|
||||||
frame_time = run_time / (len(regions))
|
frame_time = run_time / (len(regions))
|
||||||
for region, count in zip(regions, it.count(1)):
|
for region, count in zip(regions, it.count(1)):
|
||||||
num_mob = TexMobject(str(count))
|
num_mob = Tex(str(count))
|
||||||
num_mob.center().shift(num_offset)
|
num_mob.center().shift(num_offset)
|
||||||
self.add(num_mob)
|
self.add(num_mob)
|
||||||
self.set_color_region(region)
|
self.set_color_region(region)
|
||||||
|
@ -113,7 +113,7 @@ class GeneralizedPascalsTriangle(VMobject):
|
||||||
]
|
]
|
||||||
for n, k in self.coords:
|
for n, k in self.coords:
|
||||||
center = self.coords_to_center(n, k)
|
center = self.coords_to_center(n, k)
|
||||||
num_mob = self.submob_class(n, k) # TexMobject(str(num))
|
num_mob = self.submob_class(n, k) # Tex(str(num))
|
||||||
scale_factor = min(
|
scale_factor = min(
|
||||||
1,
|
1,
|
||||||
self.portion_to_fill * self.cell_height / num_mob.get_height(),
|
self.portion_to_fill * self.cell_height / num_mob.get_height(),
|
||||||
|
@ -137,7 +137,7 @@ class GeneralizedPascalsTriangle(VMobject):
|
||||||
def generate_n_choose_k_mobs(self):
|
def generate_n_choose_k_mobs(self):
|
||||||
self.coords_to_n_choose_k = {}
|
self.coords_to_n_choose_k = {}
|
||||||
for n, k in self.coords:
|
for n, k in self.coords:
|
||||||
nck_mob = TexMobject(r"{%d \choose %d}" % (n, k))
|
nck_mob = Tex(r"{%d \choose %d}" % (n, k))
|
||||||
scale_factor = min(
|
scale_factor = min(
|
||||||
1,
|
1,
|
||||||
self.portion_to_fill * self.cell_height / nck_mob.get_height(),
|
self.portion_to_fill * self.cell_height / nck_mob.get_height(),
|
||||||
|
@ -161,7 +161,7 @@ class GeneralizedPascalsTriangle(VMobject):
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def generate_sea_of_zeros(self):
|
def generate_sea_of_zeros(self):
|
||||||
zero = TexMobject("0")
|
zero = Tex("0")
|
||||||
self.sea_of_zeros = []
|
self.sea_of_zeros = []
|
||||||
for n in range(self.nrows):
|
for n in range(self.nrows):
|
||||||
for a in range((self.nrows - n) / 2 + 1):
|
for a in range((self.nrows - n) / 2 + 1):
|
||||||
|
|
|
@ -6,7 +6,7 @@ from manimlib.constants import *
|
||||||
from manimlib.mobject.geometry import Arrow
|
from manimlib.mobject.geometry import Arrow
|
||||||
from manimlib.mobject.geometry import Circle
|
from manimlib.mobject.geometry import Circle
|
||||||
from manimlib.mobject.geometry import Dot
|
from manimlib.mobject.geometry import Dot
|
||||||
from manimlib.mobject.svg.tex_mobject import TexMobject
|
from manimlib.mobject.svg.tex_mobject import Tex
|
||||||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
from manimlib.mobject.types.vectorized_mobject import VGroup
|
||||||
from manimlib.scene.scene import Scene
|
from manimlib.scene.scene import Scene
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ class CountingScene(Scene):
|
||||||
self.dots = VGroup()
|
self.dots = VGroup()
|
||||||
self.number = 0
|
self.number = 0
|
||||||
self.max_place = 0
|
self.max_place = 0
|
||||||
self.number_mob = VGroup(TexMobject(str(self.number)))
|
self.number_mob = VGroup(Tex(str(self.number)))
|
||||||
self.number_mob.scale(self.num_scale_factor)
|
self.number_mob.scale(self.num_scale_factor)
|
||||||
self.number_mob.shift(self.num_start_location)
|
self.number_mob.shift(self.num_start_location)
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ class CountingScene(Scene):
|
||||||
place = 0
|
place = 0
|
||||||
max_place = self.max_place
|
max_place = self.max_place
|
||||||
while place < max_place:
|
while place < max_place:
|
||||||
digit = TexMobject(str(self.get_place_num(num, place)))
|
digit = Tex(str(self.get_place_num(num, place)))
|
||||||
if place >= len(self.digit_place_colors):
|
if place >= len(self.digit_place_colors):
|
||||||
self.digit_place_colors += self.digit_place_colors
|
self.digit_place_colors += self.digit_place_colors
|
||||||
digit.set_color(self.digit_place_colors[place])
|
digit.set_color(self.digit_place_colors[place])
|
||||||
|
|
|
@ -8,7 +8,7 @@ from manimlib.constants import *
|
||||||
from manimlib.mobject.geometry import Circle
|
from manimlib.mobject.geometry import Circle
|
||||||
from manimlib.mobject.geometry import Line
|
from manimlib.mobject.geometry import Line
|
||||||
from manimlib.mobject.matrix import Matrix
|
from manimlib.mobject.matrix import Matrix
|
||||||
from manimlib.mobject.svg.tex_mobject import TexMobject
|
from manimlib.mobject.svg.tex_mobject import Tex
|
||||||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
from manimlib.mobject.types.vectorized_mobject import VGroup
|
||||||
from manimlib.scene.scene import Scene
|
from manimlib.scene.scene import Scene
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ class NumericalMatrixMultiplication(Scene):
|
||||||
for c in range(k)
|
for c in range(k)
|
||||||
for prefix in ["" if c == 0 else "+"]
|
for prefix in ["" if c == 0 else "+"]
|
||||||
]
|
]
|
||||||
mob_matrix[a][b] = TexMobject(parts, next_to_buff=0.1)
|
mob_matrix[a][b] = Tex(parts, next_to_buff=0.1)
|
||||||
return Matrix(mob_matrix)
|
return Matrix(mob_matrix)
|
||||||
|
|
||||||
def add_lines(self, left, right):
|
def add_lines(self, left, right):
|
||||||
|
@ -80,7 +80,7 @@ class NumericalMatrixMultiplication(Scene):
|
||||||
self.show_frame()
|
self.show_frame()
|
||||||
|
|
||||||
def organize_matrices(self, left, right, result):
|
def organize_matrices(self, left, right, result):
|
||||||
equals = TexMobject("=")
|
equals = Tex("=")
|
||||||
everything = VGroup(left, right, equals, result)
|
everything = VGroup(left, right, equals, result)
|
||||||
everything.arrange()
|
everything.arrange()
|
||||||
everything.set_width(FRAME_WIDTH - 1)
|
everything.set_width(FRAME_WIDTH - 1)
|
||||||
|
|
|
@ -9,8 +9,8 @@ from manimlib.mobject.geometry import Line
|
||||||
from manimlib.mobject.geometry import Rectangle
|
from manimlib.mobject.geometry import Rectangle
|
||||||
from manimlib.mobject.geometry import RegularPolygon
|
from manimlib.mobject.geometry import RegularPolygon
|
||||||
from manimlib.mobject.number_line import NumberLine
|
from manimlib.mobject.number_line import NumberLine
|
||||||
from manimlib.mobject.svg.tex_mobject import TexMobject
|
from manimlib.mobject.svg.tex_mobject import Tex
|
||||||
from manimlib.mobject.svg.tex_mobject import TextMobject
|
from manimlib.mobject.svg.tex_mobject import TexText
|
||||||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
from manimlib.mobject.types.vectorized_mobject import VGroup
|
||||||
from manimlib.mobject.types.vectorized_mobject import VectorizedPoint
|
from manimlib.mobject.types.vectorized_mobject import VectorizedPoint
|
||||||
from manimlib.scene.scene import Scene
|
from manimlib.scene.scene import Scene
|
||||||
|
@ -84,7 +84,7 @@ class GraphScene(Scene):
|
||||||
self.x_labeled_nums = [x for x in self.x_labeled_nums if x != 0]
|
self.x_labeled_nums = [x for x in self.x_labeled_nums if x != 0]
|
||||||
x_axis.add_numbers(*self.x_labeled_nums)
|
x_axis.add_numbers(*self.x_labeled_nums)
|
||||||
if self.x_axis_label:
|
if self.x_axis_label:
|
||||||
x_label = TextMobject(self.x_axis_label)
|
x_label = TexText(self.x_axis_label)
|
||||||
x_label.next_to(
|
x_label.next_to(
|
||||||
x_axis.get_tick_marks(), UP + RIGHT,
|
x_axis.get_tick_marks(), UP + RIGHT,
|
||||||
buff=SMALL_BUFF
|
buff=SMALL_BUFF
|
||||||
|
@ -118,7 +118,7 @@ class GraphScene(Scene):
|
||||||
self.y_labeled_nums = [y for y in self.y_labeled_nums if y != 0]
|
self.y_labeled_nums = [y for y in self.y_labeled_nums if y != 0]
|
||||||
y_axis.add_numbers(*self.y_labeled_nums)
|
y_axis.add_numbers(*self.y_labeled_nums)
|
||||||
if self.y_axis_label:
|
if self.y_axis_label:
|
||||||
y_label = TextMobject(self.y_axis_label)
|
y_label = TexText(self.y_axis_label)
|
||||||
y_label.next_to(
|
y_label.next_to(
|
||||||
y_axis.get_corner(UP + RIGHT), UP + RIGHT,
|
y_axis.get_corner(UP + RIGHT), UP + RIGHT,
|
||||||
buff=SMALL_BUFF
|
buff=SMALL_BUFF
|
||||||
|
@ -201,7 +201,7 @@ class GraphScene(Scene):
|
||||||
buff=MED_SMALL_BUFF,
|
buff=MED_SMALL_BUFF,
|
||||||
color=None,
|
color=None,
|
||||||
):
|
):
|
||||||
label = TexMobject(label)
|
label = Tex(label)
|
||||||
color = color or graph.get_color()
|
color = color or graph.get_color()
|
||||||
label.set_color(color)
|
label.set_color(color)
|
||||||
if x_val is None:
|
if x_val is None:
|
||||||
|
@ -395,11 +395,11 @@ class GraphScene(Scene):
|
||||||
|
|
||||||
labels = VGroup()
|
labels = VGroup()
|
||||||
if dx_label is not None:
|
if dx_label is not None:
|
||||||
group.dx_label = TexMobject(dx_label)
|
group.dx_label = Tex(dx_label)
|
||||||
labels.add(group.dx_label)
|
labels.add(group.dx_label)
|
||||||
group.add(group.dx_label)
|
group.add(group.dx_label)
|
||||||
if df_label is not None:
|
if df_label is not None:
|
||||||
group.df_label = TexMobject(df_label)
|
group.df_label = Tex(df_label)
|
||||||
labels.add(group.df_label)
|
labels.add(group.df_label)
|
||||||
group.add(group.df_label)
|
group.add(group.df_label)
|
||||||
|
|
||||||
|
@ -444,9 +444,9 @@ class GraphScene(Scene):
|
||||||
triangle.set_fill(color, 1)
|
triangle.set_fill(color, 1)
|
||||||
triangle.set_stroke(width=0)
|
triangle.set_stroke(width=0)
|
||||||
if label is None:
|
if label is None:
|
||||||
T_label = TexMobject(self.variable_point_label, fill_color=color)
|
T_label = Tex(self.variable_point_label, fill_color=color)
|
||||||
else:
|
else:
|
||||||
T_label = TexMobject(label, fill_color=color)
|
T_label = Tex(label, fill_color=color)
|
||||||
|
|
||||||
T_label.next_to(triangle, DOWN)
|
T_label.next_to(triangle, DOWN)
|
||||||
v_line = self.get_vertical_line_to_graph(
|
v_line = self.get_vertical_line_to_graph(
|
||||||
|
|
|
@ -20,8 +20,8 @@ from manimlib.mobject.matrix import Matrix
|
||||||
from manimlib.mobject.matrix import VECTOR_LABEL_SCALE_FACTOR
|
from manimlib.mobject.matrix import VECTOR_LABEL_SCALE_FACTOR
|
||||||
from manimlib.mobject.matrix import vector_coordinate_label
|
from manimlib.mobject.matrix import vector_coordinate_label
|
||||||
from manimlib.mobject.mobject import Mobject
|
from manimlib.mobject.mobject import Mobject
|
||||||
from manimlib.mobject.svg.tex_mobject import TexMobject
|
from manimlib.mobject.svg.tex_mobject import Tex
|
||||||
from manimlib.mobject.svg.tex_mobject import TextMobject
|
from manimlib.mobject.svg.tex_mobject import TexText
|
||||||
from manimlib.mobject.types.vectorized_mobject import VGroup
|
from manimlib.mobject.types.vectorized_mobject import VGroup
|
||||||
from manimlib.mobject.types.vectorized_mobject import VMobject
|
from manimlib.mobject.types.vectorized_mobject import VMobject
|
||||||
from manimlib.scene.scene import Scene
|
from manimlib.scene.scene import Scene
|
||||||
|
@ -123,10 +123,10 @@ class VectorScene(Scene):
|
||||||
rotate=False,
|
rotate=False,
|
||||||
color=None,
|
color=None,
|
||||||
label_scale_factor=VECTOR_LABEL_SCALE_FACTOR):
|
label_scale_factor=VECTOR_LABEL_SCALE_FACTOR):
|
||||||
if not isinstance(label, TexMobject):
|
if not isinstance(label, Tex):
|
||||||
if len(label) == 1:
|
if len(label) == 1:
|
||||||
label = "\\vec{\\textbf{%s}}" % label
|
label = "\\vec{\\textbf{%s}}" % label
|
||||||
label = TexMobject(label)
|
label = Tex(label)
|
||||||
if color is None:
|
if color is None:
|
||||||
color = vector.get_color()
|
color = vector.get_color()
|
||||||
label.set_color(color)
|
label.set_color(color)
|
||||||
|
@ -419,7 +419,7 @@ class LinearTransformationScene(VectorScene):
|
||||||
|
|
||||||
def add_title(self, title, scale_factor=1.5, animate=False):
|
def add_title(self, title, scale_factor=1.5, animate=False):
|
||||||
if not isinstance(title, Mobject):
|
if not isinstance(title, Mobject):
|
||||||
title = TextMobject(title).scale(scale_factor)
|
title = TexText(title).scale(scale_factor)
|
||||||
title.to_edge(UP)
|
title.to_edge(UP)
|
||||||
title.add_background_rectangle()
|
title.add_background_rectangle()
|
||||||
if animate:
|
if animate:
|
||||||
|
|
Loading…
Add table
Reference in a new issue