diff --git a/client/src/components/anims/triage.jsx b/client/src/components/anims/triage.jsx new file mode 100644 index 00000000..34eff8b0 --- /dev/null +++ b/client/src/components/anims/triage.jsx @@ -0,0 +1,72 @@ +const preact = require('preact'); +const { Component } = require('preact'); +const anime = require('animejs').default; + +const { TIMES, COLOURS } = require('../../constants'); +const { randomPoints } = require('../../utils'); + +function projectile(x, y, radius, colour) { + return ( + + ); +} + +class Triage extends Component { + constructor(props) { + super(); + this.team = props.team; + this.animations = []; + const points = randomPoints(15, 10, { x: 0, y: 0, width: 300, height: 400 }); + this.charges = points.map(coord => projectile(coord[0], coord[1], 15, COLOURS.GREEN)); + } + + render() { + return ( + + + + + + + + + + {this.charges} + + + ); + } + + componentDidMount() { + this.animations.push(anime({ + targets: ['#triage'], + opacity: [ + { value: 1, delay: TIMES.TARGET_DELAY_MS, duration: TIMES.TARGET_DURATION_MS * 0.2 }, + { value: 0, delay: TIMES.TARGET_DURATION_MS * 0.6, duration: TIMES.TARGET_DURATION_MS * 0.2 }, + ], + easing: 'easeInOutSine', + })); + + this.animations.push(anime({ + targets: ['#triage circle'], + cx: 150, + cy: 200, + delay: TIMES.TARGET_DELAY_MS, + duration: TIMES.TARGET_DURATION_MS, + easing: 'easeInOutElastic', + })); + } +} + +module.exports = Triage;