Skip to content

ollieparsley/motion.js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 

Repository files navigation

                 __                            _____  ____       
 /'\_/`\        /\ \__  __                    /\___ \/\  _`\     
/\      \    ___\ \ ,_\/\_\    ___    ___     \/__/\ \ \,\L\_\   
\ \ \__\ \  / __`\ \ \/\/\ \  / __`\/' _ `\      _\ \ \/_\__ \   
 \ \ \_/\ \/\ \L\ \ \ \_\ \ \/\ \L\ \\ \/\ \    /\ \_\ \/\ \L\ \ 
  \ \_\\ \_\ \____/\ \__\\ \_\ \____/ \_\ \_\   \ \____/\ `\____\
   \/_/ \/_/\/___/  \/__/ \/_/\/___/ \/_/\/_/    \/___/  \/_____/

A library to help with modern browsers that handle device motion and orientation.

For example: shaking, twisting and moving a device.

Homepage:	http://motionjs.org
Examples:	http://motionjs.org/examples
Creator:	http://twitter.com/ollieparsley
Twitter:	http://twitter.com/motionjs



Simple shake detection example:

//Listen for the shake start
window.addEventListener('shakestart', function(event){
	//Do something
});
				
//Listen for the shake end
window.addEventListener('shakeend', function(event){
	//Do something else
});

//Listen for the device facing up
window.addEventListener('faceupstart', function(event){
	//Do something
});

//Listen for the device no longer facing up
window.addEventListener('faceupend', function(event){
	//Do something
});

About

A library to help with modern browsers that handle device motion and orientation. For example: shaking, twisting and moving a device.

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published