Device motion

If your target device supports accelerometers, you can use acceleration data

You can get acceleration data by defining an onDeviceMotion function in your main App function. If you have a device (and a browser) that supports accelerometers, go ahead and shake it to resize the red square.
App = function() { this.init = function() { this.sprite = new Sprite(); this.sprite.setSize(100, 100); this.sprite.setDrawFunction(wade.drawFunctions.solidFill_('red')); var obj = new SceneObject(this.sprite); wade.addSceneObject(obj); }; this.onDeviceMotion = function(eventData) { var a = eventData.acceleration; var acceleration = Math.sqrt(a.x * a.x + a.y * a.y + a.z * a.z); var size = 100 + acceleration * 10; this.sprite.setSize(size, size); }; };
Your code was executed successfully!