From: soufiane Date: Thu, 24 Aug 2023 10:26:48 +0000 (+0200) Subject: wip #6194 @0:30 correctif animation runningman X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=eeae823fd7ba01f1aa85de107e502fab2e7920cf;p=fluidbook-toolbox-quiz.git wip #6194 @0:30 correctif animation runningman --- diff --git a/js/quiz.screens.js b/js/quiz.screens.js index 217cbf7..368ca2c 100644 --- a/js/quiz.screens.js +++ b/js/quiz.screens.js @@ -9,6 +9,7 @@ function QuizScreens(quiz) { this.activeScreen = null; this.currentQuestionAnswers = []; this.intervalCountDown = 0; + this.runningManTimeout = 0; this.intro = new QuizScreenIntro(this); this.outro = new QuizScreenOutro(this); @@ -163,10 +164,6 @@ QuizScreens.prototype = { if($this.quiz.question.current() !== undefined) { if (parseInt($this.quiz.question.current().countdown_enable)) { $this.countdown() - setTimeout(() => { - $this.quiz.animations.runningMan() - $(".runningman").css("opacity", 1) - }, 350) } } } @@ -229,6 +226,14 @@ QuizScreens.prototype = { const $this = this; const time = this.quiz.question.current().countdown_time*1000 let value = 100 + + clearTimeout($this.runningManTimeout) + + this.runningManTimeout = setTimeout(() => { + $this.quiz.animations.runningMan() + $(".active-screen .runningman").css("opacity", 1) + }, 350) + this.intervalCountDown = setInterval(function () { value -= (10 / time) * 100 document.documentElement.style.setProperty("--width-bg-countdown", value + "%")