From 49e3de8b389b574df94652fd2dba148ce3dc73f4 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 22 May 2020 15:41:34 +0100 Subject: [PATCH] changed the animation of the crown icon --- public/js/script.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/public/js/script.js b/public/js/script.js index 2cb83c752..55ce2db67 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -424,18 +424,26 @@ function calculateStats() { } function hideCrown() { - $("#result .stats .wpm .crownWrapper").css('width', 0); + $("#result .stats .wpm .crownWrapper").css('opacity', 0); } function showCrown() { $("#result .stats .wpm .crownWrapper").animate({ - width: '1.7rem' - }, 250); + opacity: 1 + }, 250,"easeOutCubic"); } function showResult() { testEnd = Date.now(); let stats = calculateStats(); + if(stats === undefined){ + stats = { + wpm: 0, + acc: 0, + correctChars: 0, + incorrectChars: 0 + } + } clearIntervals(); $("#result .stats .wpm .bottom").text(stats.wpm); $("#result .stats .acc .bottom").text(stats.acc + "%");