]> _ Git - fluidbook-toolbox-quiz.git/commitdiff
wip #6194 @3:00 animation outro, score
authorsoufiane <soufiane@cubedesigners.com>
Fri, 25 Aug 2023 15:38:23 +0000 (17:38 +0200)
committersoufiane <soufiane@cubedesigners.com>
Fri, 25 Aug 2023 15:38:23 +0000 (17:38 +0200)
js/quiz.screen.intro.js
js/quiz.screen.outro.js
style/101-header-footer.sass
style/105-outro.sass
views/header_title.blade.php
views/screens/outro.blade.php

index 5aab70666ba5204cfd395002a6129c3070a244e0..623b42c68f60e5d0a05caabb9df62024493ba6ca 100644 (file)
@@ -1,5 +1,6 @@
 import gsap from "gsap";
 import SplitType from 'split-type';
+import { DrawSVGPlugin } from "gsap/DrawSVGPlugin.js";
 
 function QuizScreenIntro(screens) {
     this.quiz = screens.quiz;
@@ -9,7 +10,6 @@ function QuizScreenIntro(screens) {
 QuizScreenIntro.prototype = {
     show: function () {
         let $this = this;
-
         this.screens.showScreen('welcome', function () {
             $this.animate();
             $("#start").on("click", function () {
@@ -20,15 +20,19 @@ QuizScreenIntro.prototype = {
     },
 
     animate: function () {
+        gsap.registerPlugin(DrawSVGPlugin);
         //animer le texte d'intro
         let title = new SplitType("#welcome h2", {types: 'words, chars'})
         let text = new SplitType("#welcome p", {types: 'words, chars'})
         gsap.timeline({delay: .4})
-        .to("#title", {
+        .to(".active-screen .title-header", {
             y: 0
         })
+        .from("#Ellipse_33_00000130640493289073085310000003655705460857783465_", {
+            drawSVG: 0
+        })
         .to("#start", {
-            y: 0
+            y: 0,
         },.2)
         .from(title.words, {
             opacity: 0, y: 20, duration: .2, stagger: 0.05
index cffde79505fef397fa2733b0e1cf70c94469e258..79eb432a1753291ac0bcc0047d7ad8b94b7610f9 100644 (file)
@@ -1,3 +1,4 @@
+import gsap from "gsap";
 import SimpleBar from 'simplebar'
 import 'simplebar/dist/simplebar.css'
 import Handlebars from "handlebars";
@@ -16,6 +17,23 @@ QuizScreenOutro.prototype = {
         })
     },
 
+    animate: function (percent) {
+        console.log("percent",percent)
+        gsap.to(".active-screen #progress-circle", {drawSVG: 0, duration: 0})
+        gsap.timeline({delay: .4})
+            .to(".active-screen .title-header", {
+                y: 0
+            })
+            .to(".active-screen footer", {
+                y: 0
+            })
+            .to(".active-screen #progress-circle", {
+                drawSVG: percent+"%",
+                duration: 2,
+                ease: "power4.easeIn"
+            })
+    },
+
     show: function () {
         let maxScore = this.quiz.score.maxScore,
             score = this.quiz.score.score
@@ -30,6 +48,10 @@ QuizScreenOutro.prototype = {
             counter.addClass("ok")
         }
 
+        const percent = (score/maxScore) * 100
+
+        this.animate(percent)
+
         reviewList = reviewList.map((c, i) => {
             return {
                 'question': c['question'],
index 5e6941745a488d7ae973ac21bdcead1a102ed904..af64c6eed3d0a7043bfa5256e533aeb447556280 100644 (file)
@@ -5,7 +5,7 @@ footer
 header
     z-index: 1
 
-#title
+.title-header
     height: 80px
     +flex-config(space-between,false,row,center)
     margin-top: -24px
@@ -51,7 +51,6 @@ header
     z-index: 2
     +padding-container()
     +flex-config(space-between,false,row,center)
-
     .btn.primary
         width: 100%
         max-width: 400px
index 7ba43607483bd99a1050f9de46d03f65473d8054..3a6468cd4ae2339fd04a4cf4151fcc487a5f182c 100644 (file)
 
             svg
                 overflow: visible
-                width: calc(100% - 12px)
-                height: calc(100% - 12px)
+                width: 100%
                 position: absolute
+                transform: rotate(270deg)
                 circle
-                    stroke-width: 6px
+                    stroke-width: 8px
                 circle:not(#progress-circle)
                     +opacity(.16,color,$texts-color)
+                #overlay-circle
+                    display: none
 
     &-answers-review_container
         width: 36.11111%
             .answer
                 +opacity(.8,color,$texts-color)
 
+    .toggle-answers-review
+        display: none
+
     footer
         position: absolute
         width: calc(100% - 48px)
         bottom: 24px
         z-index: 1
+        transform: translateY(calc(100% + 24px))
         .restart-sentence
             margin-bottom: 14px
         .controls
                 left: 1px
                 right: 1px
 
+
 .m
     .score
         height: 600px //680(hauteur de base) - 80(hauteur du header)
         &-counter
             margin: 0 0 24px
             font-size: 56px
+            #overlay-circle
+                display: initial
         &-answers-review_container
             width: 100%
             height: 100%
index 38bd0537dbf9153796dbb819040dab24655d4361..ca599380ad7d8100ac3b84bbb4e7721d3865e37f 100644 (file)
@@ -1,4 +1,4 @@
-<header id="title">
-    <h1 id="quizTitle">{{$data->title}}</h1>
+<header class="title-header">
+    <h1>{{$data->title}}</h1>
     <img src="{{$data->theme->logo}}" id="logo"/>
 </header>
index 42621598767f0b8ea66b861de87300153ae383f8..aff91b1dc454e7adccdf9df9c217c200b654b64f 100644 (file)
@@ -6,11 +6,15 @@
                 <div class="score-counter">
                     <div id="progress-counter">
                         <span id="score-counter">0</span><span>/</span><span id="maxScore-counter">0</span>
-                        <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 100 100" xml:space="preserve">
-                            <circle cx="50" cy="50" r="48" fill="transparent" stroke="currentColor" />
-                            <circle id="progress-circle" fill="none" stroke="currentColor" stroke-width="1.2" stroke-mitterlimit="0" cx="50" cy="50" r="48" stroke-dasharray="360" stroke-linecap="round" transform="rotate(-90 ) translate(-100 0)" >
-                                <!--<animate attributeName="stroke-dashoffset" values="360;0" dur="2s" repeatCount="indefinite"></animate>-->
-                            </circle>
+                        <svg xmlns:x="http://ns.adobe.com/Extensibility/1.0/" xmlns:i="http://ns.adobe.com/AdobeIllustrator/10.0/" xmlns:graph="http://ns.adobe.com/Graphs/1.0/" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="SCORE" x="0px" y="0px" viewBox="0 0 194 194" style="enable-background:new 0 0 194 194;" xml:space="preserve">
+                            <style type="text/css">
+                                .st0{opacity:8.000000e-02;fill:#250C66;enable-background:new    ;}
+                                .st1{opacity:0.16;fill:none;stroke:#FFFFFF;stroke-miterlimit:10;enable-background:new    ;}
+                                .st2{fill:none;stroke-linecap:round;stroke-miterlimit:10;}
+                            </style>
+                            <circle id="overlay-circle" class="st0" cx="97" cy="97" r="97"/>
+                            <circle id="circle" class="st1" cx="97" cy="97" r="70"/>
+                            <circle id="progress-circle" class="st2" cx="97" cy="97" r="70" stroke="currentColor"/>
                         </svg>
                     </div>
                 </div>