Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smooth transitions #740

Open
SylvainCorlay opened this issue Apr 22, 2018 · 4 comments
Open

Smooth transitions #740

SylvainCorlay opened this issue Apr 22, 2018 · 4 comments

Comments

@SylvainCorlay
Copy link

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.

@hainm
Copy link
Collaborator

hainm commented Apr 22, 2018

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.

@SylvainCorlay
Copy link
Author

I think that this is something that you can do on the javascript side, and would remain when embedding.

@hainm
Copy link
Collaborator

hainm commented Apr 22, 2018

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

@hainm
Copy link
Collaborator

hainm commented May 1, 2019

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.
membrane2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants