Animate different actors one at the time
See original GitHub issueHi guys. First of all, thank you so much for developing vtkPlotter. I have been a VTK user (C++ and Python) for many years now and I found amazing what can be achieved using vtkPlotter with only a few lines of code.
Here is what I am working on. I have a time sequence of an object (closed mesh) with 32 timepoints. I want to animate the movement and deformation of this object in time. Usually I would export each timepoint as a vtk polydata file, open the sequence of files in paraview and play it. However, I want to do that in vtkPlotter if possible. The code bellow is my very first attempt – no animation so far. Could you guys help me to improve it? I can help to turn this into an official example if you think it might be of interest of others. Thanks a lot,
n = 8
vp = Plotter()
coo = np.random.rand(n*12).reshape(n,12)
for i in range(n):
u = coo[i,3:6]
v = coo[i,6:9]
q = coo[i,9:12]
ell = Ellipsoid(pos=(2.5*coo[i,0], 2.5*coo[i,1], 2.5*coo[i,2]), axis1=u, axis2=v, axis3=q)
scals = [i] * ell.N()
ell.pointColors(scals, vmin=0, vmax=n)
ell.VisibilityOff()
vp += ell
vp.show()
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (5 by maintainers)
Top GitHub Comments
Yes… the jupyter functionality is still experimental and at the moment is not working well with loops. It’ s on my to-do list… If you need to work in notebooks you still have the option of setting:
then the normal vtk rendering window will pop up.
Hi @vianamp thanks for your interest! Actually the
show()
command should be inside the loop. Check out for example this:Let me know if you need more help. Also, you can find more examples of animations in example/simulations directory which may fit your need.