JavaScript, HTML5 and Accelerometer for iOS 4.2+ update: Newtonian Physics

Keith Waters

Figure 1: A real-time interactive simulation of F=ma. If you're not using a decent browser - you have my sympathy. Try FireFox, Chrome, Opera, or event better Sarfari that is HTML5 compliant.
Abstract

Creating simulations of physical systems is the bread and butter of Computer Graphics. More recently, the capabilities of Web rendering and JavaScript in HTML5 canvas has become sufficiently powerful to write such code directly.

Figure 1 is a live JavaScript demonstation of canvas using Newtonian physics simulation. If you have updated your iPhone to at least iOS 4.2 devices accelerometer events are used to control gravity. The race is now on to make JavaScript really fly!