import sys
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
pi = np.pi
imgs = []
maki = 3
r0 = 1
a = 2
kaku0 = 2 * pi * r0 / a
ara = 12
pon = maki * ara + 1
kaku = np.linspace(0, 2 * pi * maki, pon)
kakut = kaku + kaku0
r = a * kakut / (2 * pi)
x = r * np.cos(kakut)
y = r * np.sin(kakut)
fig, ax = plt.subplots()
ax.set_aspect('equal')
ax.grid()
ax.set_xlim(-10,10)
ax.set_ylim(-10,10)
ax.scatter(0,0, c='r')
for i in range(1,pon+1):
rkak = -kakut[i-1] - pi/2
xr = x[:i] * np.cos(rkak) - y[:i] * np.sin(rkak)
yr = x[:i] * np.sin(rkak) + y[:i] * np.cos(rkak)
img = ax.plot(xr, yr, c='b')
imgs.append(img)
anime = animation.ArtistAnimation(fig, imgs)
plt.show()
plt.close()
sys.exit()