diff --git a/client/src/components/animations.jsx b/client/src/components/animations.jsx index 8995596c..fa3ca533 100644 --- a/client/src/components/animations.jsx +++ b/client/src/components/animations.jsx @@ -4,6 +4,7 @@ const Blast = require('./anims/blast'); const Heal = require('./anims/heal'); const Strike = require('./anims/strike'); const Chaos = require('./anims/chaos'); +const Slay = require('./anims/slay'); const Test = require('./anims/test'); const AttackCharge = require('./anims/attack.charge'); @@ -48,7 +49,7 @@ function animations(props) { case 'Blast': return ; case 'Strike': return ; case 'Chaos': return ; - + case 'Slay': return ; case 'Heal': return ; default: return text; } @@ -66,8 +67,8 @@ function animations(props) {
- ); -*/ return (
 
); + );*/ + return (
 
); } module.exports = animations; diff --git a/client/src/components/anims/blast.jsx b/client/src/components/anims/blast.jsx index 4e7790e4..fd8de797 100644 --- a/client/src/components/anims/blast.jsx +++ b/client/src/components/anims/blast.jsx @@ -72,7 +72,7 @@ class AttackCharge extends Component { anime.set('.skill-anim', { translateY: -200, }); - + anime.set('#explosion feDisplacementMap', { scale: 1, }); diff --git a/client/src/components/anims/slay.jsx b/client/src/components/anims/slay.jsx new file mode 100644 index 00000000..9128b342 --- /dev/null +++ b/client/src/components/anims/slay.jsx @@ -0,0 +1,137 @@ +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 ( + + ); +} + +function sword(colour) { + return ( + + + + + + ); +} + +class AttackCharge extends Component { + constructor(props) { + super(); + this.team = props.team; + // this.colour = props.colour; + this.colour = '#c5a443'; + const points = new Array(30).fill(0); + this.charges = points.map(() => projectile(150, 420, 7, '#1FF01F')); + } + + render() { + return ( + + + + + + + + + + + + + + {sword(this.colour)} + {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: -400, + translateX: 0, + }); + anime.set('#explosion feDisplacementMap', { + scale: 100, + }); + + anime.set('#sword', { + fill: this.colour, + stroke: this.colour, + }); + + anime.set('#projectile', { + cx: 150, + cy: 420, + }); + + anime({ + targets: '.skill-anim', + translateY: 0, + translateX: 0, + loop: false, + duration: (duration * 1 / 2), + easing: 'easeInQuad', + }); + anime({ + targets: '#explosion feDisplacementMap', + scale: 10000, + loop: false, + delay: (duration * 1 / 2), + duration: (duration * 1 / 2), + easing: 'easeInQuad', + }); + + anime({ + targets: '#sword', + fill: '#1FF01F', + stroke: '#1FF01F', + delay: (duration * 3 / 4), + }); + + const projectiles = document.querySelectorAll('#projectile'); + projectiles.forEach(proj => { + anime({ + targets: proj, + cx: Math.random() * 250 + 25, + cy: Math.random() * 200 - 100, + delay: (duration * 2 / 3), + duration: (duration * 1 / 3), + easing: 'easeInQuad', + }); + }); + } +} + +module.exports = AttackCharge; diff --git a/client/src/components/anims/test.jsx b/client/src/components/anims/test.jsx index c8f82566..da6e5297 100644 --- a/client/src/components/anims/test.jsx +++ b/client/src/components/anims/test.jsx @@ -18,19 +18,28 @@ function projectile(x, y, radius, colour) { stroke-width="2" stroke={colour} id="projectile" - filter="url(#explosion)" /> ); } +function sword(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)); + this.colour = '#c5a443'; + const points = new Array(30).fill(0); + this.charges = points.map(() => projectile(150, 420, 7, '#1FF01F')); } render() { @@ -41,7 +50,6 @@ class AttackCharge extends Component { id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 400"> - // {this.charges} @@ -50,10 +58,11 @@ class AttackCharge extends Component { - + + {sword(this.colour)} {this.charges} ); @@ -70,11 +79,11 @@ class AttackCharge extends Component { }); } anime.set('.skill-anim', { - translateY: -200, + translateY: -400, translateX: 0, }); anime.set('#explosion feDisplacementMap', { - scale: 1, + scale: 100, }); anime({ @@ -82,26 +91,36 @@ class AttackCharge extends Component { translateY: 0, translateX: 0, loop: false, - duration, + duration: (duration * 1 / 2), easing: 'easeInQuad', }); anime({ targets: '#explosion feDisplacementMap', - scale: 75, + scale: 10000, loop: false, - delay: (duration * 2 / 3), - duration: (duration * 1 / 3), + delay: (duration * 1 / 2), + duration: (duration * 1 / 2), easing: 'easeInQuad', }); + anime({ + targets: '#sword', + fill: '#1FF01F', + stroke: '#1FF01F', + delay: (duration * 3 / 4), + }); + const projectiles = document.querySelectorAll('#projectile'); - projectiles.forEach(proj => anime({ - targets: proj, - cx: Math.random() * 250 + 25, - cy: Math.random() * 300 + 50, - duration, - easing: 'easeInQuad', - })); + projectiles.forEach(proj => { + anime({ + targets: proj, + cx: Math.random() * 250 + 25, + cy: Math.random() * 200 - 100, + delay: (duration * 1 / 3), + duration: (duration * 2 / 3), + easing: 'easeInQuad', + }); + }); } }