Let's shake baby! shake.js is a cool framework that uses Vibrate API from HTML5 to make smartphones shake up in different ways. You can use shake.js in your project to make your app more interactive, like notifications, games and others.
bower install shakejs --save
import script to your HTML and you're done!
<script src="shake.min.js"></script>
Now, use the object shake on your script, it has a unique method named tremble('param'), you can manipulate vibration modes through this method.
The function accept one param from its list, you can check it out below
//List of possible values
shake.tremble("zigZig");
shake.tremble("continous");
shake.tremble("sms");
shake.tremble("badum");
shake.tremble("alarmClock");
shake.tremble("sos");
shake.tremble("intruders");
shake.tremble("annoying");
shake.tremble("doorBell");
You can check browser support for this functionality on this link: https://caniuse.com/#search=Vibration%20API