Skip to content

Instantly share code, notes, and snippets.

@mariusGundersen
mariusGundersen / demo.js
Created May 2, 2012 21:29
The usefulOrientation function takes the arguments from an DeviceOrientationEvent and returns the orientation of the interface relative to the world
/*
Demo showing how to use the usefulOrientation function.
*/
function onDeviceOrientationChange(e){
console.log("deviceOrientation", e.alpha, e.beta, e.gamma);
var orientation = usefulOrientation(e.alpha, e.beta, e.gamma);
console.log("usefulOrientatino", orientation.alpha, orientation.beta, orientation.gamma);
}
window.addEventListener("deviceorientation", onDeviceOrientationChange, false);
@gre
gre / easing.js
Last active April 30, 2024 04:58
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See the COPYING file for more details.
*/
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {