Skip to content

Instantly share code, notes, and snippets.

@videlais

videlais/accelerometer.js Secret

Created Dec 25, 2013
Embed
What would you like to do?
Accelerometer2
function handleOrientation(event) {
absolute = event.absolute;
alpha = event.alpha;
beta = event.beta;
gamma = event.gamma;
}
function handleMotion(event) {
acceleration = accelerationIncludingGravity = rotationRate = {};
acceleration.x = event.acceleration.x;
acceleration.y = event.acceleration.y;
acceleration.z = event.acceleration.z;
accelerationIncludingGravity.x = event.accelerationIncludingGravity.x;
accelerationIncludingGravity.y = event.accelerationIncludingGravity.y;
accelerationIncludingGravity.z = event.accelerationIncludingGravity.z;
rotationRate.alpha = event.rotationRate.alpha;
rotationRate.beta = event.rotationRate.beta;
rotationRate.gamma = event.rotationRate.gamma;
interval = event.interval;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment