vpython/vpython-jupyter

Feature enhancement - saving animation

abhijeet-pandey opened this issue · 6 comments

Update - I really appreciate what has been done here. It would be great if the canvas object in jupyter notebook could be saved as animation file for e.g. .avi or .mp4 file on the disk just like Matplotlib. Most solutions to this problem for vpython seem to be hacky for e.g. saving series of images using capture function in Downloads folder (for windows) giving no control to user to specify where to save the file and to then deal with creating a video file externally. A built-in mechanism to save the animations directly as a video file would not only encourage people to share their vpython creations via social media but would also in turn promote usage of this excellent library.

Sorry, but I don't know what is meant by "saving the scene object", nor what is meant by "animation file". Please explain.

Hi Bruce - Apologies. I have updated my comment above.

With regards to your statement

"A built-in mechanism to save the animations directly as a video file would not only encourage people to share their vpython creations via social media but would also in turn promote usage of this excellent library."

You can also share your vpython creations using webvpython. Have a look at any of the example vpython programs at this link

https://glowscript.org/#/user/GlowScriptDemos/folder/Examples/

Just click the "run" beside any of the examples to run the vpython program in your browser. You can also publish a link so the user can view a vpython program running in the browser.

Click view beside any example program and then click "Share or export this program" to see the various ways to share a program.

https://glowscript.org/#/user/GlowScriptDemos/folder/Examples/program/Bounce-VPython/share

These methods work for pure vpython programs that don't use any other python packages.

With regards to your statement

"A built-in mechanism to save the animations directly as a video file would not only encourage people to share their vpython creations via social media but would also in turn promote usage of this excellent library."

You can also share your vpython creations using webvpython. Have a look at any of the example vpython programs at this link

https://glowscript.org/#/user/GlowScriptDemos/folder/Examples/

Just click the "run" beside any of the examples to run the vpython program in your browser. You can also publish a link so the user can view a vpython program running in the browser.

Click view beside any example program and then click "Share or export this program" to see the various ways to share a program.

https://glowscript.org/#/user/GlowScriptDemos/folder/Examples/program/Bounce-VPython/share

These methods work for pure vpython programs that don't use any other python packages.

And there's a HUGE advantage to pointing people to a Web VPython program rather than a video, because they can interact with it, including moving the camera and clicking on buttons and dragging sliders. John pointed to the Web VPython examples. Here is a URL that immediately takes you to the ex3ecution of one of thos: tinyurl.com/vporbit. And here's an example embedded in a Wordpress document:
https://brucesherwood.net/?p=191

Thanks for your thoughts and comments. I am quite satisfied with VPython's capabilities and can't wait to try them out.