const anime = require('animejs').default;

const { TIMES } = require('../../constants');

function sourceCast(id, direction) {
    const { x, y } = direction;
    return anime({
        targets: [document.getElementById(id)],
        translateX: x * 200,
        translateY: y * 200,
        easing: 'easeInOutElastic',
        direction: 'alternate',
        duration: TIMES.SOURCE_DURATION_MS,
    });
}

module.exports = sourceCast;
