diff --git a/client/src/components/animations.jsx b/client/src/components/animations.jsx index 9f9ad039..8995596c 100644 --- a/client/src/components/animations.jsx +++ b/client/src/components/animations.jsx @@ -1,9 +1,9 @@ const preact = require('preact'); -const Attack = require('./anims/attack'); const Blast = require('./anims/blast'); +const Heal = require('./anims/heal'); const Strike = require('./anims/strike'); - +const Chaos = require('./anims/chaos'); const Test = require('./anims/test'); const AttackCharge = require('./anims/attack.charge'); @@ -47,6 +47,9 @@ function animations(props) { case 'Attack': return ; case 'Blast': return ; case 'Strike': return ; + case 'Chaos': return ; + + case 'Heal': return ; default: return text; } } @@ -59,13 +62,12 @@ function animations(props) { {combatAnim} ; } - - /*return ( +/* return (
- );*/ - return (
 
); + ); +*/ return (
 
); } module.exports = animations; diff --git a/client/src/components/anims/blast.jsx b/client/src/components/anims/blast.jsx index 83a47d0d..4e7790e4 100644 --- a/client/src/components/anims/blast.jsx +++ b/client/src/components/anims/blast.jsx @@ -60,11 +60,19 @@ class AttackCharge extends Component { } componentDidMount() { + if (!this.props.team) { + anime.set('.skill-anim', { + rotate: Math.random() * 180 + 90, + }); + } else { + anime.set('.skill-anim', { + rotate: Math.random() * 180 + 270, + }); + } anime.set('.skill-anim', { - rotate: 90, translateY: -200, - translateX: 0, }); + anime.set('#explosion feDisplacementMap', { scale: 1, }); @@ -72,7 +80,6 @@ class AttackCharge extends Component { anime({ targets: '.skill-anim', translateY: 0, - translateX: 0, loop: false, duration: (duration * 1 / 2), easing: 'easeInQuad', diff --git a/client/src/components/anims/chaos.jsx b/client/src/components/anims/chaos.jsx new file mode 100644 index 00000000..8a5c37c3 --- /dev/null +++ b/client/src/components/anims/chaos.jsx @@ -0,0 +1,108 @@ +const preact = require('preact'); +const { Component } = require('preact'); +const anime = require('animejs').default; + +const { TIMES } = require('../../constants'); +const { randomPoints } = require('../../utils'); + +const duration = TIMES.START_SKILL; + + +function projectile(x, y, radius, colour) { + return ( + + ); +} + +class AttackCharge extends Component { + constructor(props) { + super(); + this.team = props.team; + // this.colour = props.colour; + this.colour = '#A25AC1'; + const points = randomPoints(7, 30, { x: 0, y: 0, width: 300, height: 100 }); + this.charges = points.map(coord => projectile(coord[0], coord[1], 14, this.colour)); + } + + render() { + return ( + + // {this.charges} + + + + + + + + + + + + + {this.charges} + + ); + } + + componentDidMount() { + if (!this.props.team) { + anime.set('.skill-anim', { + rotate: Math.random() * 180 + 90, + }); + } else { + anime.set('.skill-anim', { + rotate: Math.random() * 180 + 270, + }); + } + anime.set('.skill-anim', { + translateY: -200, + translateX: 0, + }); + anime.set('#explosion feDisplacementMap', { + scale: 1, + }); + + anime({ + targets: '.skill-anim', + translateY: 0, + translateX: 0, + loop: false, + duration: (duration * 2 / 3), + easing: 'easeInQuad', + }); + anime({ + targets: '#explosion feDisplacementMap', + scale: 75, + loop: false, + delay: (duration * 2 / 3), + duration: (duration * 1 / 3), + easing: 'easeInQuad', + }); + + const projectiles = document.querySelectorAll('#projectile'); + projectiles.forEach(proj => anime({ + targets: proj, + cx: Math.random() * 250 + 25, + cy: Math.random() * 300 + 50, + duration: (duration * 2 / 3), + easing: 'easeInQuad', + })); + } +} + +module.exports = AttackCharge; diff --git a/client/src/components/anims/heal.jsx b/client/src/components/anims/heal.jsx new file mode 100644 index 00000000..7e982ff1 --- /dev/null +++ b/client/src/components/anims/heal.jsx @@ -0,0 +1,106 @@ +const preact = require('preact'); +const { Component } = require('preact'); +const anime = require('animejs').default; + +const { TIMES } = require('../../constants'); +const { randomPoints } = require('../../utils'); + +const duration = TIMES.START_SKILL; + + +function projectile(x, y, radius, colour) { + return ( + + ); +} + +class Heal extends Component { + constructor(props) { + super(); + this.team = props.team; + // this.colour = props.colour; + this.colour = '#1FF01F'; + const points = randomPoints(15, 30, { x: 0, y: 0, width: 300, height: 400 }); + this.charges = points.map(coord => projectile(coord[0], coord[1], 14, this.colour)); + } + + render() { + return ( + + // {this.charges} + + + + + + + + + + + + + {this.charges} + + ); + } + + componentDidMount() { + if (!this.props.team) { + anime.set('.skill-anim', { + rotate: Math.random() * 180 + 90, + }); + } else { + anime.set('.skill-anim', { + rotate: Math.random() * 180 + 270, + }); + } + anime.set('.skill-anim', { + translateY: -200, + translateX: 0, + }); + anime.set('#explosion feDisplacementMap', { + scale: 100, + }); + + anime({ + targets: '.skill-anim', + translateY: 0, + translateX: 0, + loop: false, + duration: (duration * 1 / 2), + easing: 'easeInQuad', + }); + anime({ + targets: '#explosion feDisplacementMap', + scale: 1, + loop: false, + duration: (duration * 1 / 2), + easing: 'easeInQuad', + }); + anime({ + targets: '#projectile', + cx: 150, + cy: 200, + delay: (duration * 1 / 2), + duration: (duration * 1 / 2), + easing: 'easeInQuad', + }); + } +} + +module.exports = Heal; diff --git a/client/src/components/anims/strike.jsx b/client/src/components/anims/strike.jsx index 4302cef1..91ace433 100644 --- a/client/src/components/anims/strike.jsx +++ b/client/src/components/anims/strike.jsx @@ -83,8 +83,6 @@ class Strike extends Component { scale: 1, }); - - anime({ targets: '.skill-anim', translateY: 0, diff --git a/client/src/components/anims/test.jsx b/client/src/components/anims/test.jsx index 2232dfc0..c8f82566 100644 --- a/client/src/components/anims/test.jsx +++ b/client/src/components/anims/test.jsx @@ -3,21 +3,21 @@ const { Component } = require('preact'); const anime = require('animejs').default; const { TIMES } = require('../../constants'); +const { randomPoints } = require('../../utils'); const duration = TIMES.START_SKILL; -function laser(dimensions, colour) { - const { x, y, length } = dimensions; +function projectile(x, y, radius, colour) { return ( - ); @@ -28,15 +28,9 @@ class AttackCharge extends Component { super(); this.team = props.team; // this.colour = props.colour; - this.colour = '#a52a2a'; - - const coord = [0, 100, 200]; - const points = coord.map(pos => ({ - x: pos + Math.random() * 80, - y: 50 + Math.random() * 100, - length: 150 + Math.random() * 100, - })); - this.charges = points.map(pos => laser(pos, this.colour)); + this.colour = '#A25AC1'; + const points = randomPoints(7, 30, { x: 0, y: 0, width: 300, height: 100 }); + this.charges = points.map(coord => projectile(coord[0], coord[1], 14, this.colour)); } render() { @@ -66,8 +60,16 @@ class AttackCharge extends Component { } componentDidMount() { + if (!this.props.team) { + anime.set('.skill-anim', { + rotate: Math.random() * 180 + 90, + }); + } else { + anime.set('.skill-anim', { + rotate: Math.random() * 180 + 270, + }); + } anime.set('.skill-anim', { - rotate: 90, translateY: -200, translateX: 0, }); @@ -80,17 +82,26 @@ class AttackCharge extends Component { translateY: 0, translateX: 0, loop: false, - duration: (duration * 1 / 2), + duration, easing: 'easeInQuad', }); anime({ targets: '#explosion feDisplacementMap', - scale: 200, + scale: 75, loop: false, - delay: (duration * 1 / 4), - duration, + delay: (duration * 2 / 3), + duration: (duration * 1 / 3), easing: 'easeInQuad', }); + + const projectiles = document.querySelectorAll('#projectile'); + projectiles.forEach(proj => anime({ + targets: proj, + cx: Math.random() * 250 + 25, + cy: Math.random() * 300 + 50, + duration, + easing: 'easeInQuad', + })); } }