showing xp gain

This commit is contained in:
Miodec 2022-08-02 01:11:07 +02:00
parent a266b577aa
commit c6a04adc44
3 changed files with 15 additions and 1 deletions

View file

@ -65,6 +65,15 @@
background: var(--main-color);
border-radius: var(--roundness);
}
.xpGain {
position: absolute;
left: 100%;
margin-left: 0.5rem;
top: 0;
transform: translateY(-50%);
font-size: 0.75rem;
color: var(--main-color);
}
}
}
}

View file

@ -81,6 +81,8 @@ export async function updateXpBar(
$("#menu .xpBar").stop(true, true).css("opacity", 0);
$("#menu .xpBar .xpGain").text(`+${addedXp}`);
await Misc.promiseAnimation(
$("#menu .xpBar"),
{
@ -169,7 +171,9 @@ export async function updateXpBar(
$("#menu .xpBar")
.stop(true, true)
.css("opacity", 1)
.animate({ opacity: 0 }, 250);
.animate({ opacity: 0 }, 250, () => {
$("#menu .xpBar .xpGain").text(``);
});
}, 1000);
}

View file

@ -115,6 +115,7 @@
<div class="level">1</div>
<div class="xpBar">
<div class="bar"></div>
<div class="xpGain"></div>
</div>
</div>
</a>