我做了这门课:50分的螺旋变圆。
但是动画是连续的,我想同时开始。
class SpiralToCircle(Scene):
def construct(self):
vertices1 = range(50)
vertices2 = range(50)
edges = [(48, 49),(3, 4)]
g1 = Graph(vertices1, edges, layout="spiral")
g2 = Graph(vertices2, edges, layout="circular")
# self.add(graph)
self.play(Create(g1))
self.wait(5)
for i in vertices1:
self.play(g1[i].animate.move_to(g2[i]))
self.wait()
我想过这个技巧,但我返回一个错误:
self.play((g1[i].animate.move_to(g2[i])) for i in vertices1)
类型错误:意外的参数 <generator object GraphCircular.construct.. at 0x00000229667509E0> 传递给 Scene.play()。