gpt4 book ai didi

manim - 如何在特定位置开始写入文字?

转载 作者:行者123 更新时间:2023-12-03 08:02:18 25 4
gpt4 key购买 nike

我在 Manim Community v0.16.0.post0 中有以下文本:

dioscuri = Text("DIOSCURI", weight=BOLD, font="Arial", color=BLACK)
self.play(Write(dioscuri))

我希望使用 Write 方法写入文本,例如,在左上角而不是默认情况下在场景的中心。换句话说,如何在特定位置启动文字书写动画?

最佳答案

如果您特别希望文本位于左上角位置,那么实现此目的的一个很好的简单方法是

# Send to the upper-left corner.
dioscuri = Text("DIOSCURI", weight=BOLD, font="Arial", color=BLACK).to_edge(UL)
self.play(Write(dioscuri))

如果你想给出坐标,你可以这样做

# Place it at coordinates (x,y) measured from the center of the screen.
dioscuri = Text("DIOSCURI", weight=BOLD, font="Arial", color=BLACK).move_to([x,y,0])
self.play(Write(dioscuri))

或者,如果指定坐标的其他方式更有意义,您也可以将其放置在一个角落,然后将其移动一个移位向量。

# Send to the lower-right corner, then shift by vector (x,y).
dioscuri = Text("DIOSCURI", weight=BOLD, font="Arial", color=BLACK).to_edge(DR).shift([x,y,0])
self.play(Write(dioscuri))

关于manim - 如何在特定位置开始写入文字?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73602402/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com