From 189cbea0bf68b9a573706f887a36f9bb9873245e Mon Sep 17 00:00:00 2001 From: ntr Date: Tue, 2 Jul 2019 22:10:37 +1000 Subject: [PATCH] fix hex --- client/src/components/animations.jsx | 2 + client/src/components/anims/heal.jsx | 87 +++++++++++----------------- client/src/components/anims/hex.jsx | 8 +-- 3 files changed, 39 insertions(+), 58 deletions(-) diff --git a/client/src/components/animations.jsx b/client/src/components/animations.jsx index 19af3209..9251f1be 100644 --- a/client/src/components/animations.jsx +++ b/client/src/components/animations.jsx @@ -24,6 +24,7 @@ const Reflect = require('./anims/reflect'); const Chaos = require('./anims/chaos'); const Invert = require('./anims/invert'); const Slay = require('./anims/slay'); +const Triage = require('./anims/triage'); const Siphon = require('./anims/siphon'); const SiphonTick = require('./anims/siphon.tick'); @@ -118,6 +119,7 @@ function animations(props) { case 'Parry': return ; case 'Recharge': return ; case 'Reflect': return ; + case 'Triage': return ; case 'Invert': return ; case 'Siphon': return ; case 'SiphonTick': return ; diff --git a/client/src/components/anims/heal.jsx b/client/src/components/anims/heal.jsx index 4f0ad3b4..2d5b2b09 100644 --- a/client/src/components/anims/heal.jsx +++ b/client/src/components/anims/heal.jsx @@ -2,23 +2,17 @@ const preact = require('preact'); const { Component } = require('preact'); const anime = require('animejs').default; -const { TIMES } = require('../../constants'); +const { TIMES, COLOURS } = require('../../constants'); const { randomPoints } = require('../../utils'); -const duration = TIMES.TARGET_DURATION_MS; - - function projectile(x, y, radius, colour) { return ( ); } @@ -28,75 +22,60 @@ class Heal extends Component { super(); this.team = props.team; this.animations = []; - const points = randomPoints(15, 30, { x: 0, y: 0, width: 300, height: 400 }); - this.charges = points.map(coord => projectile(coord[0], coord[1], 14, '#1FF01F')); + const points = randomPoints(30, 10, { x: 0, y: 0, width: 300, height: 400 }); + this.charges = points.map(coord => projectile(coord[0], coord[1], 12, COLOURS.GREEN)); } render() { return ( - - - - + + + + + - - - - - - - {this.charges} + + {this.charges} + ); } componentDidMount() { - anime.set('#explosion feDisplacementMap', { - scale: 100, - }); - anime.set('.skill-anim', { - opacity: 0, - }); - this.animations.push(anime({ - targets: '.skill-anim', + targets: ['#heal'], opacity: [ - { value: 1, delay: TIMES.TARGET_DELAY_MS, duration: TIMES.TARGET_DURATION_MS * 0.3 }, + { 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: '.skill-anim', + // translateY: 0, + // translateX: 0, + // loop: false, + // delay: TIMES.TARGET_DELAY_MS, + // duration: (duration * 1 / 2), + // easing: 'easeInQuad', + // })); + this.animations.push(anime({ - targets: '.skill-anim', - translateY: 0, - translateX: 0, - loop: false, - delay: TIMES.TARGET_DELAY_MS, - duration: (duration * 1 / 2), - easing: 'easeInQuad', - })); - this.animations.push(anime({ - targets: '#explosion feDisplacementMap', - scale: 1, - loop: false, - delay: TIMES.TARGET_DELAY_MS, - duration: (duration * 1 / 2), - easing: 'easeInQuad', - })); - this.animations.push(anime({ - targets: '#projectile', + targets: ['#heal circle'], cx: 150, cy: 200, - delay: (TIMES.TARGET_DELAY_MS + duration * 1 / 2), - duration: (duration * 1 / 2), - easing: 'easeInQuad', + delay: TIMES.TARGET_DELAY_MS, + duration: TIMES.TARGET_DURATION_MS * 1.5, + easing: 'easeInOutSine', + direction: 'reverse', })); } } diff --git a/client/src/components/anims/hex.jsx b/client/src/components/anims/hex.jsx index 842464cb..86cf757c 100644 --- a/client/src/components/anims/hex.jsx +++ b/client/src/components/anims/hex.jsx @@ -59,8 +59,8 @@ class Hex extends Component { points: '64 124.94732621931382 8.574 96.00354944613788 8.62269130211947 32.03166105954991 64 4 119.37730869788052 32.03166105954991 119.426 96.00354944613788', easing: 'easeOutExpo', - delay: TIMES.TARGET_MAIN_DELAY, - duration: TIMES.TARGET_MAIN_DURATION, + delay: TIMES.TARGET_DELAY_MS, + duration: TIMES.TARGET_DURATION_MS, })); this.animations.push(anime({ @@ -69,8 +69,8 @@ class Hex extends Component { easing: 'easeInOutSine', direction: 'alternate', - delay: TIMES.TARGET_MAIN_DELAY, - duration: TIMES.TARGET_MAIN_DURATION, + delay: TIMES.TARGET_DELAY_MS, + duration: TIMES.TARGET_DURATION_MS, })); }