highlight animation hurrr

This commit is contained in:
ntr 2020-01-19 12:22:32 +10:00
parent c0cbfe6e0f
commit 8e18ca033f
2 changed files with 20 additions and 1 deletions

View File

@ -85,6 +85,10 @@
.effects { .effects {
align-self: flex-start; align-self: flex-start;
} }
&.highlight {
animation: highlight 1s infinite alternate;
}
} }
.game-construct .name { .game-construct .name {
@ -93,6 +97,15 @@
} }
} }
@keyframes highlight {
from {
background: @black;
}
to {
background: @silver;
}
}
.game-construct { .game-construct {
display: grid; display: grid;

View File

@ -15,6 +15,7 @@ const addState = connect(
ws, ws,
game, game,
authenticated,
activeSkill, activeSkill,
animFocus, animFocus,
resolution, resolution,
@ -28,6 +29,8 @@ const addState = connect(
} }
return { return {
game,
authenticated,
activeSkill, activeSkill,
animFocus, animFocus,
resolution, resolution,
@ -51,6 +54,8 @@ class GameConstruct extends preact.Component {
render() { render() {
const { const {
// Changing state variables // Changing state variables
authenticated,
game,
activeSkill, activeSkill,
animFocus, animFocus,
resolution, resolution,
@ -74,6 +79,7 @@ class GameConstruct extends preact.Component {
}; };
const unfocus = animFocus && !animFocus.includes(construct.id) ? 'unfocus' : ''; const unfocus = animFocus && !animFocus.includes(construct.id) ? 'unfocus' : '';
const highlight = !authenticated && activeSkill && game.stack.length === 0 ? 'highlight' : '';
const crypSkills = player const crypSkills = player
? <div class="skills"> {range(0, 3).map(j => <SkillBtn key={j} construct={construct} i={j} />)} </div> ? <div class="skills"> {range(0, 3).map(j => <SkillBtn key={j} construct={construct} i={j} />)} </div>
@ -84,7 +90,7 @@ class GameConstruct extends preact.Component {
<div <div
onClick={() => selectSkillTarget(construct.id)} onClick={() => selectSkillTarget(construct.id)}
style={ activeSkill ? { cursor: 'pointer' } : {}} style={ activeSkill ? { cursor: 'pointer' } : {}}
class={`game-construct ${ko} ${koEvent()} ${unfocus}`}> class={`game-construct ${ko} ${koEvent()} ${unfocus} ${highlight}`}>
<div class="left"> <div class="left">
{crypSkills} {crypSkills}
<ConstructEffectBox construct={construct} /> <ConstructEffectBox construct={construct} />