fix banish and invert

This commit is contained in:
ntr
2019-07-19 19:58:08 +10:00
parent 4ea3adcff3
commit 2026530370
4 changed files with 42 additions and 16 deletions
+8 -5
View File
@@ -33,7 +33,7 @@ class Hybrid extends Component {
class="green-one"
cx='50'
cy='150'
r='10'
r="15"
fill={COLOURS.GREEN}
stroke="none"
/>
@@ -41,7 +41,7 @@ class Hybrid extends Component {
class="green-two"
cx='250'
cy='150'
r='10'
r="15"
fill={COLOURS.GREEN}
stroke="none"
/>
@@ -49,7 +49,7 @@ class Hybrid extends Component {
class="bluewhite-one"
cx='150'
cy='50'
r='10'
r="15"
fill={COLOURS.BLUE}
stroke="none"
/>
@@ -65,7 +65,7 @@ class Hybrid extends Component {
class="bluewhite-two"
cx='150'
cy='250'
r='10'
r="15"
fill={COLOURS.BLUE}
stroke="none"
/>
@@ -77,7 +77,6 @@ class Hybrid extends Component {
fill={COLOURS.WHITE}
stroke="none"
/>
</g>
</svg>
);
@@ -100,6 +99,7 @@ class Hybrid extends Component {
}));
this.animations.push(anime({
r: [10, anime.random(10, 30)],
targets: ['#hybrid circle.green-one'],
cx: [50, 250, 50, 250],
delay: TIMES.TARGET_DELAY_MS,
@@ -109,6 +109,7 @@ class Hybrid extends Component {
}));
this.animations.push(anime({
r: [10, anime.random(10, 30)],
targets: ['#hybrid circle.green-two'],
cy: [250, 50, 250, 50],
delay: TIMES.TARGET_DELAY_MS,
@@ -118,6 +119,7 @@ class Hybrid extends Component {
}));
this.animations.push(anime({
r: [10, anime.random(10, 30)],
targets: ['#hybrid circle.bluewhite-one'],
fill: [COLOURS.WHITE, COLOURS.BLUE],
cy: [50, 250, 50, 250],
@@ -128,6 +130,7 @@ class Hybrid extends Component {
}));
this.animations.push(anime({
r: [10, anime.random(10, 30)],
targets: ['#hybrid circle.bluewhite-two'],
cx: [250, 50, 250, 50],
fill: [COLOURS.WHITE, COLOURS.BLUE],
+11 -5
View File
@@ -88,8 +88,8 @@ class ConstructAvatar extends Component {
}
switch (animTarget.skill) {
case 'banish': return banish(construct.id);
case 'invert': return invert(construct.id);
case 'Banish': return banish(construct.id);
case 'Invert': return invert(construct.id);
default: return null;
}
};
@@ -112,8 +112,8 @@ class ConstructAvatar extends Component {
this.resetAnimations();
}
shouldComponentUpdate({ animSource, construct }) {
if (animSource === this.props.animSource) {
shouldComponentUpdate({ animSource, animTarget, construct }) {
if (animSource === this.props.animSource && animTarget === this.props.animTarget) {
// console.warn(construct.name, 'thinks its same props')
return false;
}
@@ -128,12 +128,18 @@ class ConstructAvatar extends Component {
}
// this is the target
// if (animTarget && animTarget.constructId === construct.id) return true;
if (animTarget && animTarget.constructId === construct.id) {
// console.warn(construct.name, 'should update')
return true;
}
// we were previously doing src anim
const prevSrc = this.props.animSource && this.props.animSource.constructId === construct.id;
if (prevSrc && !animSource) return true;
const prevTarget = this.props.animTarget && this.props.animTarget.constructId === construct.id;
if (prevTarget && !animTarget) return true;
// console.warn(construct.name, 'not updating');
return false;