Shake.js is a vanilla javascript plugin to provide a simple access to Vibration API
bower install shakerjs
Include the shaker.js file into the index.html
// Create an instance of Shaker
var shaker = new Shaker();
// Start a continuous vibrations based on the passed speed and duration (ms)
shaker.continuousVibration({speed: 'fast', duration: 2000});
// Start a single vibration based on duration(ms).
shaker.vibrate(3000);
// Vibrate 'SOS' in Morse.
shaker.vibrate([100,30,100,30,100,200,200,30,200,30,200,200,100,30,100,30,100]);
This library relies on Vibration API. And this API is supported in the following browsers.
webkit ✔ | 11+ ✔ | Nope ✘ | Nope ✘ | Nope ✘ |
Don't be shy, send a Pull Request! Here is how:
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D