Skip to content

Commit c333caf

Browse files
committed
Bug fix. Tested
1 parent fea2f6b commit c333caf

File tree

14 files changed

+376
-73
lines changed

14 files changed

+376
-73
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
yarn.lock
2-
node_modules/
2+
node_modules/
3+
.vscode

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"sass": "^1.34.1"
55
},
66
"scripts": {
7-
"node-sass": "sass src/SASS:src/stylesheets"
7+
"node-sass": "sass src/SASS:src/stylesheets",
8+
"sass": "sass --watch src/SASS:src/stylesheets"
89
}
910
}

src/SASS/colors.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,7 @@ $red-text: $red-background;
2323
$blue-background: #3498DB;
2424
$blue-border: #21618C;
2525
$blue-text: $blue-background;
26+
27+
$success-primary: #94D34A;
28+
$success-secondary: #6F9E37;
29+
$success-transparent: #0014B022;

src/SASS/forms.scss

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ $main-shadow: 0 6px 6px 1px $shadow-color;
3232
}
3333

3434
.line {
35+
display: flex;
36+
align-self: center;
37+
width: 10%;
3538
background: linear-gradient(-90deg, #00000000, #000000de, #00000000);
3639
height: 3px;
3740
border: 0;
@@ -125,6 +128,15 @@ input:focus {
125128
}
126129
}
127130

131+
@keyframes add-width {
132+
from {
133+
width: 10%
134+
}
135+
to {
136+
width: 100%
137+
}
138+
}
139+
128140
.container>*:nth-child(even):not(.line) {
129141
animation: .7s ease-in-out move-right;
130142
}
@@ -133,10 +145,20 @@ input:focus {
133145
animation: .7s ease-in-out move-left;
134146
}
135147

136-
.container>*:first-child, .line{
148+
.container>*:first-child{
137149
animation: .7s ease move-down;
138150
}
139151

152+
.container>.line{
153+
animation: .7s ease move-down, .7s ease-in-out add-width .7s;
154+
animation-fill-mode: both;
155+
}
156+
157+
.line{
158+
animation: .7s ease-in-out add-width .7s;
159+
animation-fill-mode: both;
160+
}
161+
140162
.container>*:last-child{
141163
animation: .7s ease move-up;
142164
}

src/SASS/game.scss

Lines changed: 99 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ $main-shadow: 0 6px 6px 1px $shadow-color;
7979

8080
.after-visibility {
8181
--after-visibility: visible;
82+
--animation-duration: 1.5s;
8283
--number: 2;
8384
--color: black;
8485
}
@@ -88,7 +89,8 @@ $main-shadow: 0 6px 6px 1px $shadow-color;
8889
margin-left: 0.5em;
8990
content: '+' counter(number);
9091
position: absolute;
91-
animation: 1.5s ease-in-out counterMove;
92+
animation: ease-in-out counterMove;
93+
animation-duration: var(--animation-duration);
9294
visibility: var(--after-visibility);
9395
color: var(--color);
9496
font-weight: bold;
@@ -181,6 +183,102 @@ $main-shadow: 0 6px 6px 1px $shadow-color;
181183
}
182184
}
183185

186+
.winner-container {
187+
position: absolute;
188+
display: grid;
189+
justify-self: center;
190+
align-content: center;
191+
justify-items: center;
192+
align-self: center;
193+
grid-template-rows: 0.1fr 0.2fr 0.2fr 0.2fr 0.1fr;
194+
grid-template-columns: 0.5fr 0.5fr;
195+
width: 60%;
196+
height: 50%;
197+
top: 25%;
198+
left: 20%;
199+
.upline {
200+
grid-row: 1;
201+
grid-column-start: 1;
202+
grid-column-end: 3;
203+
}
204+
205+
.downline {
206+
grid-row: 5;
207+
grid-column-start: 1;
208+
grid-column-end: 3;
209+
}
210+
211+
.upline, .downline {
212+
height: 6px;
213+
background: linear-gradient(-90deg, #00ff4000, $success-primary, #00ff4000);
214+
}
215+
216+
@keyframes width-left-anim {
217+
from {
218+
width: 10%;
219+
left: 45%;
220+
}
221+
to {
222+
width: 100%;
223+
left: 0%;
224+
}
225+
}
226+
227+
.line::before {
228+
position: absolute;
229+
left: 45%;
230+
content: "";
231+
display: flex;
232+
align-self: center;
233+
justify-self: center;
234+
width: 10%;
235+
background: linear-gradient(-90deg, #00000000, #000000de, #00000000);
236+
height: 6px;
237+
margin-bottom: -12px;
238+
opacity: 50%;
239+
animation: .7s ease-in-out width-left-anim .7s;
240+
animation-fill-mode: both;
241+
}
242+
243+
.button-play {
244+
grid-row: 4;
245+
grid-column: 1;
246+
}
247+
248+
.button-menu {
249+
grid-row: 4;
250+
grid-column: 2;
251+
}
252+
253+
.button-menu, .button-play {
254+
width: 80%;
255+
}
256+
257+
h1 {
258+
display: block;
259+
text-align: center;
260+
text-shadow: 0 0.1rem 0.4rem $shadow-color, 0 0.4rem 0.8rem black,
261+
0 0 0.8rem $shadow-color;
262+
}
263+
264+
#player-box {
265+
color: $success-primary;
266+
grid-row: 2;
267+
grid-column-start: 1;
268+
grid-column-end: 3;
269+
}
270+
271+
#wintext-box {
272+
color: $success-primary;
273+
grid-row: 3;
274+
grid-column-start: 1;
275+
grid-column-end: 3;
276+
}
277+
}
278+
279+
280+
281+
184282
@media screen and (max-width: 1100px) {
185283
.game-container {
186284
grid-template-columns: 25% 50% 25%;

src/index.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<link rel="stylesheet" href="stylesheets/gamedice.css" />
1010
<link rel="stylesheet" href="stylesheets/forms.css" />
1111
<link rel="stylesheet" href="stylesheets/game.css" />
12+
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
1213
</head>
1314
<body>
1415
<form id="start-box" class="container">
@@ -31,7 +32,6 @@ <h1>Now rolls the dice</h1>
3132
<svg version="1.1" xmlns="//www.w3.org/2000/svg" width="100%" >
3233
<text id="turn-text" class="stroke-text" dominant-baseline="middle" x="50%" y="50%" >Player1</text>
3334
</svg>
34-
3535
</div>
3636
<div id="first-player" class="control player red" player="1">
3737
<h3>Player1</h3>
@@ -115,6 +115,16 @@ <h4>0</h4>
115115
</div>
116116
<button type="button" class="control button" id="roll-button">Roll Dice</button>
117117
</div>
118+
119+
<div id="winner-box" class="hidden">
120+
<hr class="line upline"></hr>
121+
<h1 id="wintext-box">WIN</h1>
122+
<h1 id="player-box"></h1>
123+
<button class="control button button-play" type="button" id="playagain-button">Play again</button>
124+
<button class="control button button-menu" type="button" id="tomenu-button">To menu</button>
125+
<hr class="line downline"></hr>
126+
<!-- winner-container -->
127+
</div>
118128
<script src="scripts/gamescript.js"></script>
119129
<script src="scripts/loginscript.js"></script>
120130
<script src="scripts/classes.js"></script>

0 commit comments

Comments
 (0)