K3D-tools / K3D-jupyter

K3D lets you create 3D plots backed by WebGL with high-level API (surfaces, isosurfaces, voxels, mesh, cloud points, vtk objects, volume renderer, colormaps, etc). The primary aim of K3D-jupyter is to be easy for use as stand alone package like matplotlib, but also to allow interoperation with existing libraries as VTK.
MIT License
934 stars 123 forks source link

Animating plots? #200

Closed TomNicholas closed 4 years ago

TomNicholas commented 4 years ago

Is there a way to animate data? Even just with some kind of callback to an external function which resupplies the new data for the next timestep?

TomNicholas commented 4 years ago

I noticed that if I create an isosurface I can then alter it with

list(plot.objects)[0].scalar_field = new_scalar_field

If I created a data object which changed in response to an external widget, would this be a good way to animate 3D plots? Or would it likely be too slow?

TomNicholas commented 4 years ago

Oh in this example there is a widget to update the plot, so presumably I can do something similar even without invoking VTK?

marcinofulus commented 4 years ago

Dear Tom,

We have basically two possibilities:

But - the point is that not all objects accept timeseries. Look into code e.g. l

Thus for your case I would suggest:

If you send me more information on the dataset or example notebook, I can give you some more specific advices.

TomNicholas commented 4 years ago

Thanks for explanation @marcinofulus !

Ideally I would like the simplest interoperability possible between the animate widget and the K3D plot, so I guess what I should do is wait for #191 to be closed (is there a corresponding pull request anywhere which I could check out?), and have a go with that first.

marcinofulus commented 4 years ago

All of those scenarios are the same simple or complex, but they are different. 2.7.2 is out so plot.auto_rendering = False works now.

tgandor commented 4 years ago

@TomNicholas - can we close this?

TomNicholas commented 4 years ago

Yes - I'll reopen when I have more specific difficulties.

On Thu, 26 Mar 2020 at 12:27, tgandor notifications@github.com wrote:

@TomNicholas https://github.com/TomNicholas - can we close this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/K3D-tools/K3D-jupyter/issues/200#issuecomment-604401425, or unsubscribe https://github.com/notifications/unsubscribe-auth/AISNPIZJGIDD7TAL7XJ32X3RJNCZJANCNFSM4KN2HATQ .

-- Thomas Nicholas (he/him) | PhD Student | Computational plasma physics for nuclear fusion University of York | Based at Culham Centre for Fusion Energy http://www.ccfe.ac.uk/ (D3/2.15) GitHub https://github.com/TomNicholas | LinkedIn https://www.linkedin.com/in/tom-nicholas/

etienne87 commented 1 year ago

is there an example where we can move the camera and fetch some snapshots, offline ?