Graphics Reference
In-Depth Information
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 help-
ful 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 tech-
nical stuff for us: CCapture ( https://github.com/spite/ccapture.js/ ) . To work with this lib-
rary, we need to load the following two JavaScript files at the top of our HTML page:
<script src="../libs/CCapture.min.js"></script>
<script src="../libs/Whammy.js"></script>
We've provided a very simple example that shows you this recipe in action. If you
open up 07.07-save-a-movie-of-an-animation.html in your browser, you'll
see a slowly moving cube in your browser, as shown in the following screenshot:
Search WWH ::




Custom Search