本文整理汇总了Python中mobject.tex_mobject.TextMobject.get_top方法的典型用法代码示例。如果您正苦于以下问题:Python TextMobject.get_top方法的具体用法?Python TextMobject.get_top怎么用?Python TextMobject.get_top使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mobject.tex_mobject.TextMobject
的用法示例。
在下文中一共展示了TextMobject.get_top方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: construct
# 需要导入模块: from mobject.tex_mobject import TextMobject [as 别名]
# 或者: from mobject.tex_mobject.TextMobject import get_top [as 别名]
def construct(self):
word = TextMobject(["Bra", "chis", "to", "chrone"])
original_word = word.copy()
dots = []
for part in word.split():
if dots:
part.next_to(dots[-1], buff = 0.06)
dot = TexMobject("\\cdot")
dot.next_to(part, buff = 0.06)
dots.append(dot)
dots = Mobject(*dots[:-1])
dots.shift(0.1*DOWN)
Mobject(word, dots).center()
overbrace1 = Brace(Mobject(*word.split()[:-1]), UP)
overbrace2 = Brace(word.split()[-1], UP)
shortest = TextMobject("Shortest")
shortest.next_to(overbrace1, UP)
shortest.highlight(YELLOW)
time = TextMobject("Time")
time.next_to(overbrace2, UP)
time.highlight(YELLOW)
chrono_example = TextMobject("""
As in ``Chronological'' \\\\
or ``Synchronize''
""")
chrono_example.scale(0.5)
chrono_example.to_edge(RIGHT)
chrono_example.shift(2*UP)
chrono_example.highlight(BLUE_D)
chrono_arrow = Arrow(
word.get_right(),
chrono_example.get_bottom(),
color = BLUE_D
)
brachy_example = TextMobject("As in . . . brachydactyly?")
brachy_example.scale(0.5)
brachy_example.to_edge(LEFT)
brachy_example.shift(2*DOWN)
brachy_example.highlight(GREEN)
brachy_arrow = Arrow(
word.get_left(),
brachy_example.get_top(),
color = GREEN
)
pronunciation = TextMobject(["/br", "e", "kist","e","kr$\\bar{o}$n/"])
pronunciation.split()[1].rotate_in_place(np.pi)
pronunciation.split()[3].rotate_in_place(np.pi)
pronunciation.scale(0.7)
pronunciation.shift(DOWN)
latin = TextMobject(list("Latin"))
greek = TextMobject(list("Greek"))
for mob in latin, greek:
mob.to_edge(LEFT)
question_mark = TextMobject("?").next_to(greek, buff = 0.1)
stars = Stars().highlight(BLACK)
stars.scale(0.5).shift(question_mark.get_center())
self.play(Transform(original_word, word), ShowCreation(dots))
self.play(ShimmerIn(pronunciation))
self.dither()
self.play(
GrowFromCenter(overbrace1),
GrowFromCenter(overbrace2)
)
self.dither()
self.play(ShimmerIn(latin))
self.play(FadeIn(question_mark))
self.play(Transform(
latin, greek,
path_func = counterclockwise_path()
))
self.dither()
self.play(Transform(question_mark, stars))
self.remove(stars)
self.dither()
self.play(ShimmerIn(shortest))
self.play(ShimmerIn(time))
for ex, ar in [(chrono_example, chrono_arrow), (brachy_example, brachy_arrow)]:
self.play(
ShowCreation(ar),
ShimmerIn(ex)
)
self.dither()