November 2011
Intermediate to advanced
348 pages
7h 2m
English
In this recipe, we'll create a life-like oscillating bubble using the principles of harmonic oscillation and canvas transformations.

Follow these steps to create a life-like oscillating bubble floating in the air:
Animation class:<head>
<script src="animation.js">
</script>Animation object and get the canvas context: <script>
window.onload = function(){
// instantiate new animation object
var anim = new Animation("myCanvas");
var context = anim.getContext();
var canvas = anim.getCanvas();stage() function which updates the width and height scale of the bubble, clears the canvas, ...Read now
Unlock full access