manimcamera.move_to和camera.scale同时不起作用
这是一个示例代码:
from manim import *
import numpy as np
class Problem(MovingCameraScene):
def construct(self):
circle_left = Circle(radius=2).move_to(np.array([-3, 0, 0]))
circle_right = Circle(radius=2).move_to(np.array([3, 0, 0]))
self.add(circle_left, circle_right)
self.wait()
self.play(self.camera.frame.animate.move_to(circle_left.get_center()), self.camera.frame.animate.scale(2))
self.wait()
我不明白的是为什么它只是缩小,而不是向左移动并同时缩小,只是最终以 circle_left
为中心并缩放出去。看起来 self.camera.frame.animate.move_to(circle_left.get_center())
被忽略了。
我知道将它们分成两个 self.play 是可行的,但我希望缩小和移动到左侧圆圈同时发生:/
感谢您的帮助!
Here is a sample code:
from manim import *
import numpy as np
class Problem(MovingCameraScene):
def construct(self):
circle_left = Circle(radius=2).move_to(np.array([-3, 0, 0]))
circle_right = Circle(radius=2).move_to(np.array([3, 0, 0]))
self.add(circle_left, circle_right)
self.wait()
self.play(self.camera.frame.animate.move_to(circle_left.get_center()), self.camera.frame.animate.scale(2))
self.wait()
What I don't understand is why it just zooms out and doesn't moves to the left and zooms out at the same time, only to end up centered around circle_left
AND zoomed out. It looks like self.camera.frame.animate.move_to(circle_left.get_center())
was ignored.
I know that separating them in two self.play
works but I would like both the zooming out and the moving to the left circle happening at the same time :/
Thanks for the help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Manim 不处理以这种方式调用同一 mobject 的同步动画。相反,您实际上可以使用
.animate
语法链接动画以获得您想要的效果。因此:请参阅文档中的教程以获取更多上下文:
https ://docs.manim.community/en/stable/tutorials/building_blocks.html#animating-methods
Manim doesn't handle simultaneous animations called on the same mobject in that manner. Instead, you can actually chain animations with the
.animate
syntax to get the effect you want. So:Refer to the tutorial in the docs for more context:
https://docs.manim.community/en/stable/tutorials/building_blocks.html#animating-methods