#E1
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
x_data = []
y_data = []
fig, ax = plt.subplots()
ax.set_xlim(-200, 200)
ax.set_ylim(-200,200)
line, = ax.plot(0,0)
r=1.2
def animation_frame(i):
x_data.append(-r*i*np.cos(i*i)-i*np.cos(i))
y_data.append(r*i*np.sin(i*i)+i*np.sin(i))
line.set_xdata(x_data)
line.set_ydata(y_data)
line.set_linewidth(0.3)
return line,
animation = FuncAnimation(fig, func=animation_frame, frames=np.arange(0, 132, 0.001), interval=40, blit=True)
#animation.save('E1.mp4', dpi=400, bitrate=-1, codec="libx264", extra_args=['-pix_fmt','yuv420p'])
plt.show()
print("done")
Categories