Skip to content

Commit fc6957e

Browse files
committed
made the crown animation even smoother
1 parent 866d87c commit fc6957e

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

public/js/script.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ function hideCrown() {
430430
}
431431

432432
function showCrown() {
433-
$("#result .stats .wpm .crownWrapper").animate({
433+
$("#result .stats .wpm .crownWrapper").delay(275).animate({
434434
opacity: 1
435435
}, 250,"easeOutCubic");
436436
}
@@ -456,7 +456,7 @@ function showResult() {
456456
} else if (config.mode == "words") {
457457
mode2 = config.words;
458458
}
459-
hideCrown();
459+
460460
let completedEvent = {
461461
wpm: stats.wpm,
462462
correctChars: stats.correctChars,
@@ -476,6 +476,7 @@ function showResult() {
476476
db_getUserHighestWpm(config.mode, mode2, config.punctuation, config.language).then(data => {
477477
// console.log(`highest wpm for this mode is ${data}, current is ${stats.wpm}`);
478478
if (data < stats.wpm) {
479+
hideCrown();
479480
showCrown();
480481
}
481482
completedEvent.uid = firebase.auth().currentUser.uid;
@@ -574,6 +575,7 @@ function restartTest() {
574575
$("#words").css('opacity', 0).removeClass('hidden').stop(true, true).animate({
575576
opacity: 1
576577
}, 125, () => {
578+
hideCrown();
577579
clearIntervals();
578580
$("#restartTestButton").css('opacity', 1);
579581
if ($("#commandLineWrapper").hasClass('hidden')) focusWords();

0 commit comments

Comments
 (0)