they call me "pixar pete"

This commit is contained in:
ntr
2019-09-17 15:37:34 +10:00
parent fb80f89214
commit 27c410d63d
7 changed files with 42 additions and 8 deletions
+21
View File
@@ -0,0 +1,21 @@
const anime = require('animejs').default;
function wiggle(id, idle) {
const duration = 300;
const target = document.getElementById(id);
const x = (window.screen.width / anime.random(-100, 100)) * 0.1;
const y = (window.screen.height / anime.random(-20, 100)) * 0.1;
return anime({
targets: target,
rotate: 0,
translateX: [x, -x, 0],
translateY: [y, -y, 0],
duration,
easing: 'easeInOutSine',
// direction: 'alternate',
begin: idle.pause,
complete: idle.restart,
});
}
module.exports = wiggle;