From 773da33f0eee92019cfcc0fae3649775f457d082 Mon Sep 17 00:00:00 2001 From: ntr Date: Sun, 30 Jun 2019 15:51:58 +1000 Subject: [PATCH] stun --- client/assets/styles/styles.css | 6 ++ client/src/components/animations.jsx | 2 + client/src/components/anims/amplify.jsx | 2 + client/src/components/anims/block.jsx | 2 +- client/src/components/anims/stun.jsx | 75 +++++++++++++++++++++++++ 5 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 client/src/components/anims/stun.jsx diff --git a/client/assets/styles/styles.css b/client/assets/styles/styles.css index 7ec37699..dce5f627 100644 --- a/client/assets/styles/styles.css +++ b/client/assets/styles/styles.css @@ -277,6 +277,12 @@ button[disabled] { stroke: #333; } +.white { + color: whitesmoke; + stroke: whitesmoke; +} + + /* LOGIN */ diff --git a/client/src/components/animations.jsx b/client/src/components/animations.jsx index d009fc0a..58e6e758 100644 --- a/client/src/components/animations.jsx +++ b/client/src/components/animations.jsx @@ -9,6 +9,7 @@ const banish = require('./anims/banish'); const Block = require('./anims/block'); const Buff = require('./anims/buff'); const Debuff = require('./anims/debuff'); +const Stun = require('./anims/stun'); const Heal = require('./anims/heal'); const Hex = require('./anims/hex'); const Strike = require('./anims/strike'); @@ -104,6 +105,7 @@ function animations(props) { case 'Hex': return ; case 'Siphon': return ; case 'SiphonTick': return ; + case 'Stun': return ; default: return false; } }; diff --git a/client/src/components/anims/amplify.jsx b/client/src/components/anims/amplify.jsx index 984257ee..1d8c5324 100644 --- a/client/src/components/anims/amplify.jsx +++ b/client/src/components/anims/amplify.jsx @@ -35,6 +35,8 @@ class Amplify extends Component { this.animations.push(anime({ targets: ['#amplify'], opacity: 1, + easing: 'easeInSine', + duration: TIMES.TARGET_DELAY_MS, })); this.animations.push(anime({ diff --git a/client/src/components/anims/block.jsx b/client/src/components/anims/block.jsx index 37ac6b50..f3a672fc 100644 --- a/client/src/components/anims/block.jsx +++ b/client/src/components/anims/block.jsx @@ -50,7 +50,7 @@ class Block extends Component { this.animations.push(anime({ targets: ['feTurbulence', 'feDisplacementMap'], - baseFrequency: 0, + baseFrequency: 0.02, scale: 1, easing: 'easeOutSine', diff --git a/client/src/components/anims/stun.jsx b/client/src/components/anims/stun.jsx new file mode 100644 index 00000000..dfe68482 --- /dev/null +++ b/client/src/components/anims/stun.jsx @@ -0,0 +1,75 @@ +const preact = require('preact'); +const { Component } = require('preact'); +const anime = require('animejs').default; + +const { TIMES } = require('../../constants'); + +class Stun extends Component { + constructor() { + super(); + this.animations = []; + } + + render() { + const path = 'M0,100 C100,100 100,100 200,100'; + + return ( + + + + + + + + + + ); + } + + componentDidMount() { + this.animations.push(anime({ + targets: ['#stun'], + opacity: 1, + easing: 'easeInSine', + duration: TIMES.TARGET_DELAY_MS, + })); + + this.animations.push(anime({ + targets: ['#stun'], + rotate: 360, + easing: 'easeInSine', + + duration: TIMES.TARGET_DURATION_MS, + delay: TIMES.TARGET_DELAY_MS, + })); + + this.animations.push(anime({ + targets: ['#ampFilter feTurbulence', '#ampFilter feDisplacementMap'], + baseFrequency: 0.15, + scale: 4, + easing: 'easeInOutExpo', + + duration: TIMES.TARGET_DURATION_MS, + delay: TIMES.TARGET_DELAY_MS, + })); + } + + // this is necessary because + // skipping / timing / unmounting race conditions + // can cause the animations to cut short, this will ensure the values are reset + // because preact will recycle all these components + componentWillUnmount() { + for (let i = this.animations.length - 1; i >= 0; i--) { + this.animations[i].reset(); + } + } +} + +module.exports = Stun;