def ani_frame():
dpi = 600
fig = plt.figure()
ax = fig.add_subplot(111)
ax.set_aspect('equal')
plt.xlim(0,151);
plt.ylim(0,151);
ws2 = copy.deepcopy(ws);
fig.set_size_inches([5,5])
plt.tight_layout()
ws2.plot(ax = ax);
shifts = np.linspace(0,50,100);
def update_fig(n):
ax.cla();
ws2 = copy.deepcopy(ws);
ws2.move_forward(shifts[n]);
ws2.plot(ax = ax);
ax.set_xlim(0,151);
ax.set_ylim(0,151);
return ax
#legend(loc=0)
ani = animation.FuncAnimation(fig,update_fig,100,interval=30)
writer = animation.writers['ffmpeg'](fps=30)
ani.save('forward.mp4',writer=writer,dpi=dpi)
return ani
test_active_worm.py 文件源码
python
阅读 20
收藏 0
点赞 0
评论 0
评论列表
文章目录