Book Image

Three.js Cookbook

By : Jos Dirksen
Book Image

Three.js Cookbook

By: Jos Dirksen

Overview of this book

Table of Contents (15 chapters)
Three.js Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Saving a movie of an animation in Chrome


In this chapter, we've showed you various ways to create animations. Sometimes, however, people don't have a WebGL-enabled browser, or you want to just share the resulting animation and not the WebGL website. In these cases, it would be very helpful to be able to just save the animation to your local filesystem and share it. In this recipe, we show you one approach you can use for this scenario.

Getting ready

To work with this recipe, you need to make sure that you use Google Chrome. We use an internal functionality to save the animation as a WebM file, which unfortunately, still only works on Google Chrome. We don't have to create the complete functionality for this recipe from scratch, as there is a library available that handles the low-level technical stuff for us: CCapture (https://github.com/spite/ccapture.js/). To work with this library, we need to load the following two JavaScript files at the top of our HTML page:

  <script src="../libs/CCapture...