Tilt
Slow
Tilt
Medium
Tilt
Fast
Horizontal
Slow
Horizontal
Medium
Horizontal
Fast
Vertical
Slow
Vertical
Medium
Vertical
Fast
Jump
Slow
Jump
Medium
Jump
Fast
Pulse
Slow
Pulse
Medium
Pulse
Fast
Blur
Slow
Blur
Medium
Blur
Fast
:)
<p id="box">:)</p>
<div class="buttons">
<button id="tilt">Tilt</button>
<button id="horizontal">Horizontal</button>
<button id="vertical">Vertical</button>
<button id="jump">Jump</button>
<button id="pulse">Pulse</button>
<button id="blur">Blur</button>
</div>
const box = document.getElementById('box');
const duration = Shake.cycle(1);
const speed = 'medium';
document.getElementById('tilt').addEventListener('click', () => {
box.shake().stop();
box.shake().start('tilt', speed, duration);
});
document.getElementById('horizontal').addEventListener('click', () => {
box.shake().stop();
box.shake().start('horizontal', speed, duration);
});
document.getElementById('vertical').addEventListener('click', () => {
box.shake().stop();
box.shake().start('vertical', speed, duration);
});
document.getElementById('jump').addEventListener('click', () => {
box.shake().stop();
box.shake().start('jump', speed, duration);
});
document.getElementById('pulse').addEventListener('click', () => {
box.shake().stop();
box.shake().start('pulse', speed, duration);
});
document.getElementById('blur').addEventListener('click', () => {
box.shake().stop();
box.shake().start('blur', speed, duration);
});