const preact = require('preact'); const { Component } = require('preact'); const anime = require('animejs').default; const { TIMES } = require('../../constants'); const duration = TIMES.START_SKILL; class Attack extends Component { constructor(props) { super(); this.props = props; } render() { return ( ); } componentDidMount() { let value = ''; if ((!this.props.team && this.props.stage === 'START_SKILL') || (this.props.team && this.props.stage === 'END_SKILL')) { anime.set('.attack-anim', { translateY: -250, }); value = '+=250px'; } if ((!this.props.team && this.props.stage === 'END_SKILL') || (this.props.team && this.props.stage === 'START_SKILL')) { anime.set('.attack-anim', { translateY: 0, }); value = '-=250px'; } anime({ targets: ['.attack-anim'], translateY: { value, duration, }, loop: false, duration, easing: 'easeInQuad', }); } } module.exports = Attack;