本文整理汇总了Python中mobject.tex_mobject.TexMobject.scale_to_fit_width方法的典型用法代码示例。如果您正苦于以下问题:Python TexMobject.scale_to_fit_width方法的具体用法?Python TexMobject.scale_to_fit_width怎么用?Python TexMobject.scale_to_fit_width使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mobject.tex_mobject.TexMobject
的用法示例。
在下文中一共展示了TexMobject.scale_to_fit_width方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show_sin_thetas
# 需要导入模块: from mobject.tex_mobject import TexMobject [as 别名]
# 或者: from mobject.tex_mobject.TexMobject import scale_to_fit_width [as 别名]
def show_sin_thetas(self):
pc = Line(self.p_point, self.c_point)
mob = Mobject(self.theta, self.d_mob).copy()
mob.ingest_submobjects()
triplets = [
(pc, "D\\sin(\\theta)", 0.5),
(self.y_line, "D\\sin^2(\\theta)", 0.7),
]
for line, tex, scale in triplets:
trig_mob = TexMobject(tex)
trig_mob.scale_to_fit_width(
scale*line.get_length()
)
trig_mob.shift(-1.2*trig_mob.get_top())
trig_mob.rotate(line.get_angle())
trig_mob.shift(line.get_center())
if line is self.y_line:
trig_mob.shift(0.1*UP)
self.play(Transform(mob, trig_mob))
self.add(trig_mob)
self.dither()
self.remove(mob)
self.d_sin_squared_theta = trig_mob
示例2: specifics_concepts
# 需要导入模块: from mobject.tex_mobject import TexMobject [as 别名]
# 或者: from mobject.tex_mobject.TexMobject import scale_to_fit_width [as 别名]
def specifics_concepts(self):
matrix_vector_product = TexMobject(" ".join([
matrix_to_tex_string(EXAMPLE_TRANFORM),
matrix_to_tex_string(TRANFORMED_VECTOR),
"&=",
matrix_to_tex_string([
["1 \\cdot 1 + 0 \\cdot 2"],
["1 \\cdot 1 + (-1)\\cdot 2"]
]),
"\\\\ &=",
matrix_to_tex_string([[1], [-1]]),
]))
matrix_vector_product.scale_to_fit_width(SPACE_WIDTH-0.5)
matrix_vector_product.next_to(self.vline, LEFT)
self.play(
Write(self.numeric),
FadeIn(matrix_vector_product),
run_time = 2
)
self.dither()
self.play(Write(self.geometric, run_time = 2))
### Paste in linear transformation
self.dither()
digest_locals(self)
示例3: scale_vector
# 需要导入模块: from mobject.tex_mobject import TexMobject [as 别名]
# 或者: from mobject.tex_mobject.TexMobject import scale_to_fit_width [as 别名]
def scale_vector(self, v, factor, v_label,
v_name = "v", factor_tex = None):
starting_mobjects = list(self.mobjects)
if factor_tex is None:
factor_tex = str(factor)
scaled_vector = self.add_vector(
factor*v.get_end(), animate = False
)
self.remove(scaled_vector)
label_tex = "%s\\vec{\\textbf{%s}}"%(factor_tex, v_name)
label = self.label_vector(
scaled_vector, label_tex, animate = False,
add_to_vector = False
)
self.remove(label)
factor_mob = TexMobject(factor_tex)
if factor_mob.get_height() > 1:
factor_mob.scale_to_fit_height(0.9)
if factor_mob.get_width() > 1:
factor_mob.scale_to_fit_width(0.9)
factor_mob.shift(1.5*RIGHT+2.5*UP)
num_factor_parts = len(factor_mob.split())
factor_mob_parts_in_label = label.split()[:num_factor_parts]
label_remainder_parts = label.split()[num_factor_parts:]
factor_in_label = VMobject(*factor_mob_parts_in_label)
label_remainder = VMobject(*label_remainder_parts)
self.play(Write(factor_mob, run_time = 1))
self.dither()
self.play(
ApplyMethod(v.copy().highlight, DARK_GREY),
ApplyMethod(v_label.copy().highlight, DARK_GREY),
Transform(factor_mob, factor_in_label),
Transform(v.copy(), scaled_vector),
Transform(v_label.copy(), label_remainder),
)
self.dither(2)
self.clear()
self.add(*starting_mobjects)