anim simplified and fixed hopefully

This commit is contained in:
Mashy
2019-09-15 13:21:04 +10:00
parent de088b73c5
commit dbe38a8815
4 changed files with 19 additions and 83 deletions
+3 -1
View File
@@ -2,7 +2,7 @@ const anime = require('animejs').default;
const { TIMES } = require('../../constants');
function Banish(id) {
function Banish(id, idle) {
return anime({
targets: [document.getElementById(id)],
scaleY: 0,
@@ -11,6 +11,8 @@ function Banish(id) {
delay: TIMES.TARGET_DELAY_MS,
duration: TIMES.TARGET_DURATION_MS * 0.45,
direction: 'alternate',
begin: idle.pause,
complete: idle.play,
});
}
+3 -1
View File
@@ -2,7 +2,7 @@ const anime = require('animejs').default;
const { TIMES } = require('../../constants');
function Invert(id) {
function Invert(id, idle) {
return anime({
targets: [document.getElementById(id)],
rotate: 180,
@@ -10,6 +10,8 @@ function Invert(id) {
duration: TIMES.TARGET_DURATION_MS * 0.45,
easing: 'easeInOutElastic',
direction: 'alternate',
begin: idle.pause,
complete: idle.play,
});
}
+5 -3
View File
@@ -2,15 +2,17 @@ const anime = require('animejs').default;
const { TIMES } = require('../../constants');
function sourceCast(id, direction) {
function sourceCast(id, direction, idle) {
const { x, y } = direction;
return anime({
targets: [document.getElementById(id)],
translateX: [0, x * 200],
translateY: [0, y * 200],
translateX: x * 200,
translateY: y * 200,
easing: 'easeInOutElastic',
direction: 'alternate',
duration: TIMES.SOURCE_DURATION_MS,
begin: idle.pause,
complete: idle.play,
});
}