mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-18 19:45:58 +08:00
showing xp gain
This commit is contained in:
parent
a266b577aa
commit
c6a04adc44
3 changed files with 15 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -115,6 +115,7 @@
|
|||
<div class="level">1</div>
|
||||
<div class="xpBar">
|
||||
<div class="bar"></div>
|
||||
<div class="xpGain"></div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
|
|
Loading…
Add table
Reference in a new issue