Browse Source

aide_ami finalisé et couloir_ami créé (équivalent couloir mais avec un ami)

Florian Ehr 3 years ago
parent
commit
a10371b555
8 changed files with 339 additions and 81 deletions
  1. 50
    28
      CSS/aide_ami.css
  2. 13
    32
      CSS/couloir.css
  3. 130
    0
      CSS/couloir_ami.css
  4. 7
    3
      HTML/aide_ami.html
  5. 4
    4
      HTML/couloir.html
  6. 40
    0
      HTML/couloir_ami.html
  7. 57
    14
      JAVASCRIPT/aide_ami.js
  8. 38
    0
      JAVASCRIPT/couloir_ami.js

+ 50
- 28
CSS/aide_ami.css View File

@@ -57,6 +57,12 @@ body {
57 57
                 max-width: 25vw;
58 58
             }
59 59
 
60
+            #firstText {
61
+                opacity:0;
62
+                animation: fade 2s forwards;
63
+                animation-delay: 1s;
64
+            }
65
+
60 66
             .textWillAppear {
61 67
                 opacity: 0;
62 68
             }
@@ -105,17 +111,22 @@ body {
105 111
                 #text p {
106 112
                     margin: 0.1vh 0 0.1vh 0;
107 113
                 }
108
-
109
-            #pseudoInput{
110
-                font-family:'Special Elite',cursive;
111
-                font-size:1.5vw;
112
-                border-radius:1vw;
113
-                width: 15vw;
114
-                padding:0.5vw 0.7vw 0.3vw 0.7vw;
115
-                
114
+            
115
+            #inputBox {
116
+                display: flex;
117
+                flex-direction: column;
118
+                align-items: center;
116 119
             }
117 120
 
118
-            #pseudoInput:focus{
121
+                #friendInput{
122
+                    font-family:'Special Elite',cursive;
123
+                    font-size:1.5vw;
124
+                    border-radius:1vw;
125
+                    width: 15vw;
126
+                    padding:0.5vw 0.7vw 0.3vw 0.7vw;
127
+                }
128
+
129
+            #friendInput:focus{
119 130
                 outline:none;
120 131
                 font-family:'Special Elite',cursive;
121 132
                 font-size:1.5vw;
@@ -123,12 +134,40 @@ body {
123 134
                 padding:0.5vw 0.7vw 0.3vw 0.7vw;
124 135
             }
125 136
 
137
+            #arrowBlock{
138
+                display:flex;
139
+                justify-content: flex-end;
140
+                height: 2vh;
141
+                width: 45vw;
142
+            }
143
+
144
+                #space{
145
+                    font-size: 1vw;
146
+                    font-family: 'Special Elite', cursive;
147
+                    padding-right: 1vw;
148
+                }
149
+
150
+                #arrow{
151
+                    animation: bounce 1s forwards;
152
+                    animation-iteration-count:infinite;
153
+                }
154
+
155
+                @keyframes bounce {
156
+                    50% {transform: translate(0, -1em);}
157
+                }
158
+
159
+                @keyframes fade-reverse {
160
+                    0% {opacity :1}
161
+                    100% {opacity:0}
162
+                }
163
+
126 164
             #buttons {
127 165
                 display: flex;
128 166
                 justify-content: space-around;
129 167
             }
130 168
 
131 169
             .button {
170
+                opacity: 0;
132 171
                 outline: none;
133 172
                 border:0.2vw solid #b9b9b9;
134 173
                 border-radius: 4vw;
@@ -136,6 +175,8 @@ body {
136 175
                 width: 20vw;
137 176
                 padding: 1vw 1.2vw 1vw 1.2vw;
138 177
                 color: black;
178
+                text-decoration: none;
179
+                text-align: center;
139 180
                 font-family: 'Special Elite', cursive;
140 181
                 font-size: 0.8vw;
141 182
                 background-image: linear-gradient(to top, black -50%, #BF0909 80%);
@@ -151,25 +192,6 @@ body {
151 192
                 background-image: linear-gradient(to top, #BF0909 20%, black 150%);
152 193
             }
153 194
 
154
-            /* Test d'animation */
155
-            @keyframes oscille {
156
-                from {
157
-                    transform: rotate(0);
158
-                }
159
-
160
-                25% {
161
-                    transform: rotate(8deg);
162
-                }
163
-
164
-                75% {
165
-                    transform: rotate(-8deg);
166
-                }
167
-
168
-                to {
169
-                    transform: rotate(0);
170
-                }
171
-            }
172
-
173 195
     footer{
174 196
         flex:0.5;
175 197
         display:flex;

+ 13
- 32
CSS/couloir.css View File

@@ -78,35 +78,16 @@ body {
78 78
                 background-image: linear-gradient(to top, #BF0909 20%, black 150%);
79 79
             }
80 80
 
81
-            /* Test d'animation */
82
-            @keyframes oscille {
83
-                from {
84
-                    transform: rotate(0);
85
-                }
86
-
87
-                25% {
88
-                    transform: rotate(8deg);
89
-                }
90
-
91
-                75% {
92
-                    transform: rotate(-8deg);
93
-                }
94
-
95
-                to {
96
-                    transform: rotate(0);
97
-                }
98
-            }
99
-
100
-            footer{
101
-                flex:0.5;
102
-                display:flex;
103
-                flex-direction: column;
104
-                justify-content:flex-end;
105
-                align-items: center;
106
-                font-size:1vw;
107
-                margin-top:2vw;
108
-            }
109
-            
110
-                #names{
111
-                    margin : 0;
112
-                }
81
+    footer{
82
+        flex:0.5;
83
+        display:flex;
84
+        flex-direction: column;
85
+        justify-content:flex-end;
86
+        align-items: center;
87
+        font-size:1vw;
88
+        margin-top:2vw;
89
+    }
90
+    
91
+        #names{
92
+            margin : 0;
93
+        }

+ 130
- 0
CSS/couloir_ami.css View File

@@ -0,0 +1,130 @@
1
+body {
2
+    display: flex;
3
+    flex-direction: column;
4
+    justify-content: space-between;
5
+    align-items: center;
6
+    color:white;
7
+    font-family: 'Special Elite', cursive;
8
+    background-color: black;
9
+    height: 95vh;
10
+}
11
+
12
+    header {
13
+        color: #BF0909;
14
+        font-family: 'Special Elite', cursive;
15
+        display: flex;
16
+        flex-direction: column;
17
+        justify-content: space-between;
18
+        align-items: center;
19
+        flex: 1;
20
+    }
21
+        h1 {
22
+            font-size: 4vw;
23
+        }
24
+
25
+        header a {
26
+            text-decoration: none;
27
+            color: #494949;
28
+        }
29
+
30
+        header a:hover {
31
+            color: white;
32
+        }
33
+
34
+    #main {
35
+        display: flex;
36
+        flex: 4;
37
+    }
38
+
39
+        #content {
40
+            display: flex;
41
+            flex-direction: column;
42
+            justify-content: space-around;
43
+            width: 50vw;
44
+        }
45
+
46
+            #text {
47
+                font-family: 'Special Elite', cursive;
48
+                font-size: 1.8vw;
49
+                text-align: center;
50
+                color: white;
51
+            }
52
+
53
+                .textWillAppear {
54
+                    opacity: 0;
55
+                }
56
+
57
+                @keyframes fade {
58
+                    100% {opacity: 1;}
59
+                }
60
+
61
+            #arrowBlock{
62
+                display: flex;
63
+                justify-content: flex-end;
64
+                height: 2vh;
65
+                width: 45vw;
66
+            }
67
+
68
+                #space{
69
+                    font-size: 1vw;
70
+                    font-family: 'Special Elite', cursive;
71
+                    padding-right: 1vw;
72
+                }
73
+
74
+                #arrow{
75
+                    height: 2vh;
76
+                    animation: bounce 1s forwards;
77
+                    animation-iteration-count:infinite;
78
+                }
79
+
80
+                @keyframes bounce {
81
+                    50% {transform: translate(0, -1em);}
82
+                }
83
+
84
+                @keyframes fade-reverse {
85
+                    0% {opacity :1}
86
+                    100% {opacity:0}
87
+                }
88
+
89
+            #buttons {
90
+                opacity: 0;
91
+                display: flex;
92
+                justify-content: space-around;
93
+            }
94
+
95
+            .button {
96
+                outline: none;
97
+                border:0.2vw solid #b9b9b9;
98
+                border-radius: 4vw;
99
+                min-width: 15vw;
100
+                width: 20vw;
101
+                padding: 1vw 1.2vw 1vw 1.2vw;
102
+                color: black;
103
+                font-family: 'Special Elite', cursive;
104
+                font-size: 0.8vw;
105
+                background-image: linear-gradient(to top, black -50%, #BF0909 80%);
106
+                cursor : pointer;
107
+            }
108
+
109
+            .button:hover {
110
+                border: 0.2vw solid white;
111
+                box-shadow: 0 0 3vw  #B0C4DE;
112
+            }
113
+
114
+            .button:active {
115
+                background-image: linear-gradient(to top, #BF0909 20%, black 150%);
116
+            }
117
+
118
+    footer{
119
+        flex:0.5;
120
+        display:flex;
121
+        flex-direction: column;
122
+        justify-content:flex-end;
123
+        align-items: center;
124
+        font-size:1vw;
125
+        margin-top:2vw;
126
+    }
127
+    
128
+        #names{
129
+            margin : 0;
130
+        }

+ 7
- 3
HTML/aide_ami.html View File

@@ -21,10 +21,14 @@
21 21
                 <div class="questionWillAppear"><p id="question2">C'était quand même bizarre d'être capuché dans le sous-sol</p></div>
22 22
             </aside>
23 23
             <article id="text">
24
-                <p class="textWillAppear">La photo est.. correcte. Au moins vous n'avez pas oublié de retirer le flash !</p>
24
+                <p id="firstText">La photo est.. correcte. Au moins vous n'avez pas oublié de retirer le flash !</p>
25 25
                 <p class="textWillAppear">Vous avez passé une nuit mouvementée par des questionnements incessants</p>
26 26
                 <p class="textWillAppear">En même temps, c'est compréhensible vu ce que vous venez de vivre. <span>On dirait que l'aventure n'est pas finie pour autant...</span></p>
27
-                <p class="textWillAppear">Le lendemain, vous vous hâtez vers votre plus fidèle ami <input id="pseudoInput" type="text"/> pour tout lui expliquer.</p>
27
+                <p class="textWillAppear">Le lendemain, vous vous hâtez vers votre plus fidèle ami <span id="inputBox"><input id="friendInput" type="text"/><span></span></span> pour tout lui expliquer.</p>
28
+                <div id="arrowBlock">
29
+                    <p id="space">Press enter</p>
30
+                    <img id="arrow" src="../Images/Lecture.png" alt="Texte suivant"/>
31
+                </div>
28 32
             </article>
29 33
             <aside id="rightQuestions">
30 34
                 <div class="questionWillAppear"><p id="question3">Peut-être devrais-je laisser tomber et oublier cette histoire</p></div>
@@ -32,7 +36,7 @@
32 36
             </aside>
33 37
         </section>
34 38
         <section id="buttons">
35
-                <button id="button1" class="button" onclick="window.location.href = './aide_ami.html';">Suivant</button>
39
+                <a id="button1" class="button">Suivant</a>
36 40
         </section>
37 41
     </main>
38 42
     <footer>

+ 4
- 4
HTML/couloir.html View File

@@ -6,8 +6,7 @@
6 6
     <title>INSAïde</title>
7 7
     <link rel="stylesheet" href="../CSS/couloir.css">
8 8
     <link rel="preconnect" href="https://fonts.gstatic.com">
9
-    <link href="https://fonts.googleapis.com/css2?family=Special+Elite&display=swap" rel="stylesheet"> 
10
-    <script defer type="text/javascript" src="../JAVASCRIPT/couloir.js"></script>
9
+    <link href="https://fonts.googleapis.com/css2?family=Special+Elite&display=swap" rel="stylesheet">
11 10
 </head>
12 11
 <body>
13 12
     <header>
@@ -25,12 +24,13 @@
25 24
             </article>
26 25
             <div id="buttons">
27 26
                 <button id="safeButton" class="button" onclick="window.location.href = './aide_ami.html';">Prendre une photo, vous en parlerez à quelqu'un plus tard</button>
28
-                <button id="riskyButton" class="button">Attendre qu'ils rentrent, prendre son courage à deux mains, et s'aventurer jusqu'à cette salle</button>
27
+                <button id="riskyButton" class="button" onclick="window.location.href = './crypto_seul.html';">Attendre qu'ils rentrent, prendre son courage à deux mains, et s'aventurer jusqu'à cette salle</button>
29 28
             </div>
30 29
         </section>
31 30
     </main>
32 31
     <footer>
33
-
32
+        <p id="names">Copyright © 2020 Florian EHR - Pierre FAVARY - Baptiste MARTY</p>
33
+        <p id="rights">Tous droits réservés </p>
34 34
     </footer>
35 35
 </body>
36 36
 </html>

+ 40
- 0
HTML/couloir_ami.html View File

@@ -0,0 +1,40 @@
1
+<!DOCTYPE html>
2
+<html lang="en">
3
+<head>
4
+    <meta charset="UTF-8">
5
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+    <title>INSAïde</title>
7
+    <link rel="stylesheet" href="../CSS/couloir_ami.css">
8
+    <link rel="preconnect" href="https://fonts.gstatic.com">
9
+    <link href="https://fonts.googleapis.com/css2?family=Special+Elite&display=swap" rel="stylesheet">
10
+    <script defer type="text/javascript" src="../JAVASCRIPT/couloir_ami.js"></script>
11
+</head>
12
+<body>
13
+    <header>
14
+        <h1>Un couloir, trois étudiants</h1>
15
+        <nav><a href='./menu.html'>Retourner au menu</a></nav>
16
+    </header>
17
+    <main id="main">
18
+        <section id="content">
19
+            <article id="text">
20
+                <p class="firstText">Texte 1</p>
21
+                <P class="textWillAppear">texte 2</p>
22
+                <p class="textWillAppear">texte 3</p>
23
+                <p class="textWillAppear">texte 4</p>
24
+                <div id="arrowBlock">
25
+                    <p id="space">Press enter</p>
26
+                    <img id="arrow" src="../Images/Lecture.png" alt="Texte suivant"/>
27
+                </div>
28
+            </article>
29
+            <div id="buttons">
30
+                <button id="button1" class="button" onclick="window.location.href = './aide_ami.html';" disabled=true>Non franchement <span id="nomAmi"></span>, je te jure je ne peux pas aller plus loin</button>
31
+                <button id="button2" class="button" onclick="window.location.href = './crypto_seul.html';" disabled=true>Attendre qu'ils rentrent, prendre votre courage à quatre mains, et s'aventurer jusqu'à cette salle</button>
32
+            </div>
33
+        </section>
34
+    </main>
35
+    <footer>
36
+        <p id="names">Copyright © 2020 Florian EHR - Pierre FAVARY - Baptiste MARTY</p>
37
+        <p id="rights">Tous droits réservés </p>
38
+    </footer>
39
+</body>
40
+</html>

+ 57
- 14
JAVASCRIPT/aide_ami.js View File

@@ -1,23 +1,66 @@
1
-let texte = document.getElementById("text");
1
+//------------------ Variables ------------------//
2 2
 let p_counter = 0;
3 3
 let texts = document.getElementsByClassName("textWillAppear");
4 4
 let questions = document.getElementsByClassName('questionWillAppear');
5
-console.log(questions);
5
+let button = document.getElementById("button1");
6
+let friendInput = document.getElementById("friendInput");
7
+let friendPseudo = '';
8
+let inputBox = document.getElementById("inputBox");
9
+let errorMsg = inputBox.childNodes[1];
10
+let buttonBox = document.getElementById("buttons");
11
+let arrow = document.getElementById("arrow");
12
+let space = document.getElementById("space");
6 13
 
14
+let NB_TEXTS = texts.length;
15
+let NB_QUESTIONS = questions.length;
16
+let NB_BUTTONS = 1;
17
+let NB_ELEMENTS_TO_APPEAR = NB_TEXTS + NB_QUESTIONS + NB_BUTTONS;
18
+
19
+//------------------ Fonctions ------------------//
20
+
21
+//gère les apparitions et disparitions des textes
7 22
 function makeNextTextAppear(event) {
8
-    if (event.keyCode == 13 || event.keyCode == 32) {
9
-        if(p_counter < 2) {
10
-            texts[p_counter].style.cssText = "animation: fade 2s forwards;";
11
-        }
12
-        if (p_counter >= 2 && p_counter < 6) {
13
-            questions[p_counter-2].style.cssText = "animation: fade 2s forwards;";
14
-            console.log(questions[p_counter-2].style.cssText);
23
+    if (p_counter < NB_ELEMENTS_TO_APPEAR) {
24
+        if (event.keyCode == 13 || event.keyCode == 32) {
25
+            if(p_counter < 1) {
26
+                texts[p_counter].style.cssText = "animation: fade 2s forwards;";
27
+            }
28
+            if (p_counter >= 1 && p_counter < 5) {
29
+                questions[p_counter-1].style.cssText = "animation: fade 2s forwards;";
30
+            }
31
+            if(p_counter >= 5 && p_counter < 7) {
32
+                texts[p_counter-NB_QUESTIONS].style.cssText = "animation: fade 2s forwards;";
33
+            }
34
+            if(p_counter == 7) {
35
+                button.style.cssText = "animation: fade 2s forwards;";
36
+                arrow.style.cssText = "animation: fade-reverse 2s forwards;"
37
+                space.style.cssText = "animation: fade-reverse 2s forwards;"
38
+            }
39
+            p_counter += 1;
15 40
         }
16
-        if(p_counter >= 6 && p_counter < 8) {
17
-            texts[p_counter-4].style.cssText = "animation: fade 2s forwards;";
18
-        }
19
-        p_counter += 1;
20 41
     }
21 42
 }
22 43
 
23
-document.addEventListener("keypress", makeNextTextAppear);
44
+function handleInputChange (event) {
45
+    friendPseudo = event.target.value;
46
+    console.log(friendPseudo);
47
+}
48
+
49
+//fonction pour gérer le bouton (qui est en fait un lien customisé)
50
+function handleButtonClicked(event) {
51
+    if (friendPseudo) {
52
+        errorMsg.innerHTML = '';
53
+        localStorage.setItem("friendPseudo", friendPseudo);
54
+        button.setAttribute('href', './couloir_ami.html');
55
+        button.click();
56
+    } else {
57
+        button.removeAttribute('href');
58
+        errorMsg.innerHTML = "Entrez un pseudo !";
59
+        errorMsg.style.cssText = "color: #BF0909; font-size: 2vh";
60
+    }
61
+}
62
+
63
+//------------------ Gestion events ------------------//
64
+document.addEventListener("keypress", makeNextTextAppear);
65
+friendInput.addEventListener("input", handleInputChange);
66
+button.addEventListener("click", handleButtonClicked);

+ 38
- 0
JAVASCRIPT/couloir_ami.js View File

@@ -0,0 +1,38 @@
1
+//------------------ Variables ------------------//
2
+let p_counter = 0;
3
+let texts = document.getElementsByClassName("textWillAppear");
4
+let buttonBox = document.getElementById("buttons");
5
+let arrow = document.getElementById("arrow");
6
+let space = document.getElementById("space");
7
+let nomAmi = document.getElementById("nomAmi");
8
+
9
+console.log(texts)
10
+
11
+let NB_TEXTS = texts.length;
12
+let NB_BUTTONS = 1;
13
+let NB_ELEMENTS_TO_APPEAR = NB_TEXTS + NB_BUTTONS;
14
+
15
+//------------------ Fonctions ------------------//
16
+
17
+nomAmi.innerHTML = localStorage.getItem('friendPseudo');
18
+
19
+//gère les apparitions et disparitions des textes
20
+function makeNextTextAppear(event) {
21
+    if (p_counter < NB_ELEMENTS_TO_APPEAR) {
22
+        if (event.keyCode == 13 || event.keyCode == 32) {
23
+            if(p_counter < NB_TEXTS) {
24
+                texts[p_counter].style.cssText = "animation: fade 2s forwards;";
25
+            }
26
+            else {
27
+                buttonBox.style.cssText = "animation: fade 2s forwards;";
28
+                arrow.style.cssText = "animation: fade-reverse 2s forwards;";
29
+                space.style.cssText = "animation: fade-reverse 2s forwards;";
30
+            }
31
+            p_counter += 1;
32
+        }
33
+    }
34
+}
35
+
36
+
37
+//------------------ Gestion events ------------------//
38
+document.addEventListener("keypress", makeNextTextAppear);

Loading…
Cancel
Save