本文整理汇总了Python中mobject.tex_mobject.TexMobject.get_bottom方法的典型用法代码示例。如果您正苦于以下问题:Python TexMobject.get_bottom方法的具体用法?Python TexMobject.get_bottom怎么用?Python TexMobject.get_bottom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mobject.tex_mobject.TexMobject
的用法示例。
在下文中一共展示了TexMobject.get_bottom方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: rearrange
# 需要导入模块: from mobject.tex_mobject import TexMobject [as 别名]
# 或者: from mobject.tex_mobject.TexMobject import get_bottom [as 别名]
def rearrange(self):
sqrt_nudge = 0.2*LEFT
y, equals = self.y_equals.split()
d, sin, squared, theta = self.y_expression.split()
y_sqrt = TexMobject("\\sqrt{\\phantom{y}}")
d_sqrt = y_sqrt.copy()
y_sqrt.shift(y.get_center()+sqrt_nudge)
d_sqrt.shift(d.get_center()+sqrt_nudge)
self.play(
ShimmerIn(y_sqrt),
ShimmerIn(d_sqrt),
ApplyMethod(squared.shift, 4*UP),
ApplyMethod(theta.shift, 1.5* squared.get_width()*LEFT)
)
self.dither()
y_sqrt.add(y)
d_sqrt.add(d)
sin.add(theta)
sin_over = TexMobject("\\dfrac{\\phantom{\\sin(\\theta)}}{\\quad}")
sin_over.next_to(sin, DOWN, 0.15)
new_eq = equals.copy()
new_eq.next_to(sin_over, LEFT)
one_over = TexMobject("\\dfrac{1}{\\quad}")
one_over.next_to(new_eq, LEFT)
one_over.shift(
(sin_over.get_bottom()[1]-one_over.get_bottom()[1])*UP
)
self.play(
Transform(equals, new_eq),
ShimmerIn(sin_over),
ShimmerIn(one_over),
ApplyMethod(
d_sqrt.next_to, one_over, DOWN,
path_func = path_along_arc(-np.pi)
),
ApplyMethod(
y_sqrt.next_to, sin_over, DOWN,
path_func = path_along_arc(-np.pi)
),
run_time = 2
)
self.dither()
brace = Brace(d_sqrt, DOWN)
constant = TextMobject("Constant")
constant.next_to(brace, DOWN)
self.play(
GrowFromCenter(brace),
ShimmerIn(constant)
)
示例2: get_vector_label
# 需要导入模块: from mobject.tex_mobject import TexMobject [as 别名]
# 或者: from mobject.tex_mobject.TexMobject import get_bottom [as 别名]
def get_vector_label(self, vector, label,
direction = "left",
rotate = False,
color = None,
label_scale_factor = VECTOR_LABEL_SCALE_FACTOR):
if not isinstance(label, TexMobject):
if len(label) == 1:
label = "\\vec{\\textbf{%s}}"%label
label = TexMobject(label)
if color is None:
color = vector.get_color()
label.highlight(color)
label.scale(label_scale_factor)
label.add_background_rectangle()
angle = vector.get_angle()
if not rotate:
label.rotate(-angle)
if direction is "left":
label.shift(-label.get_bottom() + 0.1*UP)
else:
label.shift(-label.get_top() + 0.1*DOWN)
label.rotate(angle)
label.shift((vector.get_end() - vector.get_start())/2)
return label
示例3: show_dfs
# 需要导入模块: from mobject.tex_mobject import TexMobject [as 别名]
# 或者: from mobject.tex_mobject.TexMobject import get_bottom [as 别名]
def show_dfs(self):
dx_lines = VGroup()
df_lines = VGroup()
df_dx_groups = VGroup()
df_labels = VGroup()
for i, v_line1, v_line2 in zip(it.count(1), self.v_lines, self.v_lines[1:]):
dx_line = Line(
v_line1.get_bottom(),
v_line2.get_bottom(),
color = GREEN
)
dx_line.move_to(v_line1.get_top(), LEFT)
dx_lines.add(dx_line)
df_line = Line(
dx_line.get_right(),
v_line2.get_top(),
color = YELLOW
)
df_lines.add(df_line)
df_label = TexMobject("df_%d"%i)
df_label.highlight(YELLOW)
df_label.scale(0.8)
df_label.next_to(df_line.get_center(), UP+LEFT, MED_LARGE_BUFF)
df_arrow = Arrow(
df_label.get_bottom(),
df_line.get_center(),
buff = SMALL_BUFF,
)
df_line.label = df_label
df_line.arrow = df_arrow
df_labels.add(df_label)
df_dx_groups.add(VGroup(df_line, dx_line))
for brace, dx_line, df_line in zip(self.braces, dx_lines, df_lines):
self.play(
VGroup(brace, brace.dx).next_to,
dx_line, DOWN, SMALL_BUFF,
FadeIn(dx_line),
)
self.play(ShowCreation(df_line))
self.play(
ShowCreation(df_line.arrow),
Write(df_line.label)
)
self.dither(2)
self.df_dx_groups = df_dx_groups
self.df_labels = df_labels