const preact = require('preact'); const { Component } = require('preact'); const anime = require('animejs').default; const { TIMES } = require('../../constants'); const duration = TIMES.TARGET_DURATION_MS; function projectile(x, y, radius, colour) { return ( ); } class SiphonTick extends Component { constructor(props) { super(); this.team = props.team; // this.colour = props.colour; this.colour = '#3498db'; const points = new Array(15).fill(0); this.charges = points.map(() => projectile(150, 150, 7, '#1FF01F')); } render() { return ( {this.charges} ); } componentDidMount() { if (!this.props.team) { anime.set('.skill-anim', { rotate: 90 }); } else { anime.set('.skill-anim', { rotate: 270 }); } anime.set('#projectile', { cx: 150, cy: 150, }); anime.set('#siphon', { r: '80', stroke: '#3498db', }); anime({ targets: '#siphon', keyframes: [ { r: '50', stroke: '#3498db' }, { r: '20', stroke: '#3498db' }, { r: '0', stroke: '#3498db' }, ], duration: duration * 2 / 3, easing: 'easeInCubic', }); const projectiles = document.querySelectorAll('#projectile'); projectiles.forEach(proj => { anime({ targets: proj, cx: Math.random() * 250 + 25, cy: Math.random() * 200 - 100, delay: (Math.random() * duration * 1 / 2), duration, easing: 'easeInQuad', }); }); } } module.exports = SiphonTick;