import numpy as np
import matplotlib.pyplot as plt
from io import BytesIO
from PIL import Image
r = 18
h = 1.7
num_of_steps = 1000
emp = 3
time = np.arange(0, 100, 0.4)
phi = []
theta = []
Amp = np.pi/6
fphi = 4
ftheta = 9
pics = []
r1 = 16
for j in time:
kampas = np.radians(2*np.pi*fphi*j)
kitaskampas = Amp*(np.sin(np.radians(2*np.pi*ftheta*j)))
phi.append(kampas)
theta.append(kitaskampas)
theta = 0.524
#print(theta)
x = r * np.cos(phi)
y = r * np.sin(phi) * np.cos(theta) - h * np.sin(theta)
z = r * np.sin(phi) * np.sin(theta) + h * np.cos(theta)
fig = plt.figure()
ax = plt.subplot(111, projection='3d')
ax.plot(x, y, z)
plt.show()
I've written this code, that draws a circle, angled at 30 degrees. How do I animate a circle, that stays a circle and just tilts on its center, according to angle "theta" and variable "h"?