From 40a3b2d16227b6c7a405b8b74ad5dbbd2b51b5f6 Mon Sep 17 00:00:00 2001 From: Mashy Date: Tue, 25 Jun 2019 14:15:08 +1000 Subject: [PATCH] add siphon --- client/src/components/animations.jsx | 9 ++++-- client/src/components/anims/siphon.jsx | 45 ++++++++++++++++++++++++++ client/src/components/anims/test.jsx | 40 +++++++++++------------ client/src/utils.jsx | 2 ++ 4 files changed, 73 insertions(+), 23 deletions(-) create mode 100644 client/src/components/anims/siphon.jsx diff --git a/client/src/components/animations.jsx b/client/src/components/animations.jsx index fa3ca533..c7f82e94 100644 --- a/client/src/components/animations.jsx +++ b/client/src/components/animations.jsx @@ -1,14 +1,15 @@ const preact = require('preact'); +const AttackCharge = require('./anims/attack.charge'); + 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 Siphon = require('./anims/siphon'); const Test = require('./anims/test'); -const AttackCharge = require('./anims/attack.charge'); - const { removeTier } = require('../utils'); const colours = { @@ -51,6 +52,7 @@ function animations(props) { case 'Chaos': return ; case 'Slay': return ; case 'Heal': return ; + case 'Siphon': return ; default: return text; } } @@ -67,7 +69,8 @@ function animations(props) {
- );*/ + ); +*/ return (
 
); } diff --git a/client/src/components/anims/siphon.jsx b/client/src/components/anims/siphon.jsx new file mode 100644 index 00000000..88f3ba32 --- /dev/null +++ b/client/src/components/anims/siphon.jsx @@ -0,0 +1,45 @@ +const preact = require('preact'); +const { Component } = require('preact'); +const anime = require('animejs').default; + +const { TIMES } = require('../../constants'); + +const duration = TIMES.START_SKILL; + +class AttackCharge extends Component { + render() { + return ( + + + + + + + ); + } + + componentDidMount() { + anime.set('#siphon', { + r: '140', + stroke: '#3498db', + }); + anime({ + targets: '#siphon', + keyframes: [ + { r: '110', stroke: '#1FF01F' }, + { r: '80', stroke: '#1FF01F' }, + { r: '50', stroke: '#3498db' }, + { r: '20', stroke: '#3498db' }, + ], + duration, + easing: 'easeInCubic', + }); + } +} + +module.exports = AttackCharge; diff --git a/client/src/components/anims/test.jsx b/client/src/components/anims/test.jsx index da6e5297..fe8fb5b2 100644 --- a/client/src/components/anims/test.jsx +++ b/client/src/components/anims/test.jsx @@ -22,13 +22,9 @@ function projectile(x, y, radius, colour) { ); } -function sword(colour) { +function arc() { return ( - - - - - + ); } @@ -50,26 +46,17 @@ class AttackCharge extends Component { id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 400"> - - - - - - - - - - - + + - {sword(this.colour)} + {arc()} {this.charges} ); } componentDidMount() { - if (!this.props.team) { +/* if (!this.props.team) { anime.set('.skill-anim', { rotate: Math.random() * 180 + 90, }); @@ -110,7 +97,6 @@ class AttackCharge extends Component { delay: (duration * 3 / 4), }); - const projectiles = document.querySelectorAll('#projectile'); projectiles.forEach(proj => { anime({ targets: proj, @@ -121,6 +107,20 @@ class AttackCharge extends Component { easing: 'easeInQuad', }); }); +*/ + const siphon = document.querySelectorAll('#siphon'); + anime({ + targets: siphon, + keyframes: [ + { r: '110', stroke: '#1FF01F' }, + { r: '80', stroke: '#1FF01F' }, + { r: '50', stroke: '#3498db' }, + { r: '20', stroke: '#3498db' }, + ], + duration, + easing: 'easeInCubic', + loop: true, + }); } } diff --git a/client/src/utils.jsx b/client/src/utils.jsx index d0b19020..c2352eac 100644 --- a/client/src/utils.jsx +++ b/client/src/utils.jsx @@ -383,6 +383,8 @@ function randomPoints(numPoints, radius, dimensions) { } const removeTier = skill => { + + if (skill.includes('SiphonTick')) return 'SiphonTick'; if (skill.includes('Strike')) return 'Strike'; if (skill.includes('Heal')) return 'Heal'; if (skill.includes('Blast')) return 'Blast';