nglview
nglview copied to clipboard
Smooth transitions
For animations, it could be really nice to have smooth interpolation between object positions.
If you check out the demo for ipyvolume here: http://jupyter.org/widgets, you see that even with a very large time step, it makes animations look pretty nice.
yeah I agree. We implemented the smoothing a bit but I admitted I did not spend much effort in it.
https://github.com/arose/nglview/blob/f6b665d56fb1d07ccad4447e420c353341ff7ae5/nglview/widget.py#L691-L692
I will keep this issue in mind. Thanks.
I think that this is something that you can do on the javascript side, and would remain when embedding.
ah, I think either sides is ok. The python side will compute and save the smoothed trajectory coordinates. We can update this chunk of code https://github.com/arose/nglview/blob/f6b665d56fb1d07ccad4447e420c353341ff7ae5/nglview/widget.py#L200-L215
uhm, I still don't know a proper way to smooth a trajectory on the fly in the context of nglview, so I made a "smooth" function so user can "smooth" his/her trajectory.
With the code, the animation seems nicer. Thanks @SylvainCorlay for your suggestion.
I think that this is something that you can do on the javascript side, and would remain when embedding.
I admit that I am much more efficient with python code. :(
There's one possible technical issue: nglview does not send all data (3D coordinates) for frontend but sending a single snapshot at a time. So it's easier do to the smoothing in backend.
This animation is from my screen capture.
