In [ ]:
import k3d
import numpy as np
import time 
In [ ]:
phi = np.linspace(0,10*2*np.pi,1000,dtype=np.float32)
In [ ]:
x = np.cos(phi)
y = np.sin(phi)
z = 0.1*phi
xyz = np.vstack([x,y,z]).T
In [ ]:
plot = k3d.plot()
plt_line = k3d.line(xyz,shader='mesh')
plot += plt_line
plot
In [ ]:
time.sleep(1)
plot.camera_auto_fit = False
plot.grid_auto_fit = False
In [ ]:
spiral = lambda a: np.vstack([np.cos(phi),np.sin(phi),a*phi]).T
In [ ]:
plt_line.vertices = spiral(0.1)
In [ ]:
plt_line.vertices = {str(t/10):spiral(0.05+0.05*np.sin(alfa)) 
                     for t,alfa in enumerate(np.linspace(0.0,2*np.pi,20))}
In [ ]:
plot.time=.3