question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Animate different actors one at the time

See original GitHub issue

Hi 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:closed
  • Created 4 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
marcomusycommented, Jun 17, 2019

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:

from vtkplotter import *
embedWindow(False)

then the normal vtk rendering window will pop up.

1reaction
marcomusycommented, Jun 17, 2019

Hi @vianamp thanks for your interest! Actually the show() command should be inside the loop. Check out for example this:

from vtkplotter import *
import numpy as np

vp = Plotter(interactive=False)
coo = np.random.rand(32*12).reshape(32,12)

for i in range(len(coo)):
    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=31)
    vp += ell
    vp.show()

interactive()

ezgif com-optimize

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Animate different actors one at the time · Issue #30 - GitHub
Animate different actors one at the time #30 ... I have a time sequence of an object (closed mesh) with 32 timepoints. I...
Read more >
How to apply Timeline to multiple Actors at the same time?
This video shows how to setup spline for multiple actors. You need a start offset otherwise all actors will move on top of...
Read more >
Actor Animations - Panda3D Manual
Multiple different animations for an actor may be played at the same time, and the animations blended together at runtime. The net result...
Read more >
Creating Actors, Actions, and Poses - Foundry Learn
The Actors, Actions, and Poses menus appear in a bar at the bottom of the Animate layout. This bar is under the keyframing...
Read more >
Acting and Animation - Effects Corner
Acting - Acting is one of those jobs that looks very easy to those who ... A visual effects animator may have to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found