]> _ Git - fluidbook-toolbox-quiz.git/commitdiff
wip #6194 @0:30 correctif animation runningman
authorsoufiane <soufiane@cubedesigners.com>
Thu, 24 Aug 2023 10:26:48 +0000 (12:26 +0200)
committersoufiane <soufiane@cubedesigners.com>
Thu, 24 Aug 2023 10:26:48 +0000 (12:26 +0200)
js/quiz.screens.js

index 217cbf75ecd810c733d27ec1f3c90db3ae38b440..368ca2cabfbe62ec7f7db0dc549b1d3ef82defdf 100644 (file)
@@ -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 + "%")