they call me "pixar pete"
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user