本文整理汇总了Python中mobject.vectorized_mobject.VMobject.scale_to_fit_width方法的典型用法代码示例。如果您正苦于以下问题:Python VMobject.scale_to_fit_width方法的具体用法?Python VMobject.scale_to_fit_width怎么用?Python VMobject.scale_to_fit_width使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mobject.vectorized_mobject.VMobject
的用法示例。
在下文中一共展示了VMobject.scale_to_fit_width方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: construct
# 需要导入模块: from mobject.vectorized_mobject import VMobject [as 别名]
# 或者: from mobject.vectorized_mobject.VMobject import scale_to_fit_width [as 别名]
def construct(self):
v = TexMobject(self.v_str)
v.highlight(YELLOW)
eq = TexMobject("=")
coords = Matrix(["x", "y", "z"])
eq2 = eq.copy()
if self.post_transform:
L, l_paren, r_paren = map(TexMobject, "L()")
parens = VMobject(l_paren, r_paren)
parens.scale(2)
parens.stretch_to_fit_height(
coords.get_height()
)
VMobject(L, l_paren, coords, r_paren).arrange_submobjects(buff = 0.1)
coords.submobjects = [L, l_paren] + coords.submobjects + [r_paren]
lin_comb = VMobject(*map(TexMobject, [
"x", self.i_str, "+",
"y", self.j_str, "+",
"z", self.k_str,
]))
lin_comb.arrange_submobjects(
RIGHT, buff = 0.1,
aligned_edge = ORIGIN if self.post_transform else DOWN
)
lin_comb_parts = np.array(lin_comb.split())
new_x, new_y, new_z = lin_comb_parts[[0, 3, 6]]
i, j, k = lin_comb_parts[[1, 4, 7]]
plusses = lin_comb_parts[[2, 5]]
i.highlight(X_COLOR)
j.highlight(Y_COLOR)
k.highlight(Z_COLOR)
everything = VMobject(v, eq, coords, eq2, lin_comb)
everything.arrange_submobjects(buff = 0.2)
everything.scale_to_fit_width(2*SPACE_WIDTH - 1)
everything.to_edge(DOWN)
if not self.post_transform:
lin_comb.shift(0.35*UP)
self.play(*map(Write, [v, eq, coords]))
self.dither()
self.play(
Transform(
coords.get_entries().copy(),
VMobject(new_x, new_y, new_z),
path_arc = -np.pi,
submobject_mode = "lagged_start"
),
Write(VMobject(*[eq2, i, j, k] + list(plusses))),
run_time = 3
)
self.dither()
示例2: show_formula
# 需要导入模块: from mobject.vectorized_mobject import VMobject [as 别名]
# 或者: from mobject.vectorized_mobject.VMobject import scale_to_fit_width [as 别名]
def show_formula(self):
matrix = self.get_matrix()
det_text = get_det_text(matrix)
f_str = "=(a+b)(c+d)-ac-bd-2bc=ad-bc"
formula = TexMobject(f_str)
formula.next_to(det_text, RIGHT)
everyone = VMobject(det_text, matrix, formula)
everyone.scale_to_fit_width(2*SPACE_WIDTH - 1)
everyone.next_to(DOWN, DOWN)
background_rect = BackgroundRectangle(everyone)
self.play(
ShowCreation(background_rect),
Write(everyone)
)
self.dither()
示例3: organize_matrices
# 需要导入模块: from mobject.vectorized_mobject import VMobject [as 别名]
# 或者: from mobject.vectorized_mobject.VMobject import scale_to_fit_width [as 别名]
def organize_matrices(self, left, right, result):
equals = TexMobject("=")
everything = VMobject(left, right, equals, result)
everything.arrange_submobjects()
everything.scale_to_fit_width(2*SPACE_WIDTH-1)
self.add(everything)