Compare commits

..

70 Commits

Author SHA1 Message Date
051fc223e9 Add README 2025-05-21 10:22:42 +02:00
9feaa3c098 meta 2025-05-20 17:01:49 +02:00
3175e7b7ad mouse event only on sceneDiv 2025-04-24 20:41:33 +02:00
4281bf1735 grab 2025-04-21 05:03:50 +02:00
ff37cb7823 jpg background 2025-04-14 08:40:52 +02:00
2a8df78d22 background 2025-04-14 08:30:40 +02:00
344575bdc4 center background 2025-04-13 23:28:06 +02:00
2453b2f6b6 background 2025-04-13 17:19:29 +02:00
25a98bf42d little tweaks 2025-04-10 00:52:43 +02:00
022512a5e6 perspective 2025-04-09 08:29:19 +02:00
d56af40362 clear animation 2025-04-09 01:14:39 +02:00
f33723a786 ghost border 2025-04-09 00:57:53 +02:00
df95139650 ghost 2025-04-09 00:51:34 +02:00
d3b527570c radial gradient 2025-04-08 03:42:07 +02:00
a1722a700d floatting text 2025-04-08 03:30:01 +02:00
6cc8a9e645 fix zoom 2025-04-08 00:46:47 +02:00
9023252822 remove log 2025-04-08 00:29:00 +02:00
9bf3c0de0c zoom on wheel 2025-04-07 23:51:13 +02:00
09f4785ef4 3D 2025-04-07 23:37:24 +02:00
bf9554d917 no need block 2025-04-07 09:36:51 +02:00
c33d80facb add binaural (3D) style 2025-04-07 09:30:07 +02:00
9282f94956 add binaural (3D) style 2025-04-07 09:01:14 +02:00
fda289dc9c opéra 2024-10-25 00:10:47 +02:00
b6e58b41aa opera border 2024-10-21 09:05:13 +02:00
bd5c7dad3b remove wall sound 2024-10-21 08:57:13 +02:00
7faae294dc new theme 2024-10-21 01:09:18 +02:00
3b59534f90 colored ghost 2024-09-28 17:32:07 +02:00
ec08747066 more glowing 2024-08-18 02:49:01 +02:00
db8a9a3f74 pop colors 2024-08-17 13:01:48 +02:00
0ac36444c4 disabled pop 2024-08-08 01:35:57 +02:00
5d451db8f9 disable first held piece 2024-08-03 00:07:23 +02:00
ab023ec982 show disabled held piece 2024-08-02 23:24:39 +02:00
d75696fbc3 update pop theme 2024-05-28 21:26:40 +02:00
f97b5f0cf9 fix pop buffer zone 2024-05-18 04:54:47 +02:00
ffefb77f3f serviceWorker in html 2024-05-12 11:31:31 +02:00
21929261e4 shadow 2024-04-29 17:51:17 +02:00
58389623cc move service worker 2024-04-29 17:51:04 +02:00
04f6eaf5dc fix action timout on key up 2023-12-23 03:02:47 +01:00
d56a8a6b06 stripe line clear animation 2023-12-23 03:02:17 +01:00
e1992f4c1e rgba 2023-12-23 03:02:01 +01:00
27d7a0689d rgba 2023-12-23 03:01:43 +01:00
df62a40c2a update themes 2023-12-19 00:43:27 +01:00
2105296238 not mino border 2023-12-18 01:32:42 +01:00
05862b8587 remove double lines 2023-12-18 01:29:01 +01:00
6c1291833d new Pop theme 2023-12-18 01:24:57 +01:00
095e3f8dbe modified: css/pop.css 2023-12-18 00:52:15 +01:00
82929b6f3b fix I color 2023-12-18 00:26:11 +01:00
29661421a5 fix input onblur 2023-12-14 00:39:15 +01:00
d3a6f5d6d6 check for key duplicates 2023-12-13 23:14:28 +01:00
8af1801527 sometime wall sound reset 2023-12-11 23:43:56 +01:00
6d95acddd2 fix autorepeat and volume save 2023-12-11 23:14:26 +01:00
6062f6895b aliasing 2023-12-08 22:00:18 +01:00
b726e95bed center pieces in newt and hold tables 2023-12-08 21:21:20 +01:00
228fc56916 fix settings load 2023-12-08 12:12:15 +01:00
f39d677b62 align hold table and stats 2023-12-08 08:52:39 +01:00
fc21a1b12b change stylesheet for chrome & firefox 2023-12-08 02:13:33 +01:00
072661ff5a ghost 2023-12-08 00:54:46 +01:00
f93f3c71af format 2023-12-08 00:50:56 +01:00
ed4d9b82c9 improve electro style 2023-12-08 00:05:17 +01:00
b17db2ffd4 prevent capslock 2023-12-07 23:36:06 +01:00
9f8c38e6bf update electro style 2023-12-07 22:41:28 +01:00
262a26940c this.form.querySelectorAll("[name]") 2023-12-07 22:36:00 +01:00
7996e4a7ae fix hard drop animation 2023-12-07 21:44:30 +01:00
a0af16d0dd add transparency 2023-12-07 21:44:21 +01:00
9547e585ca format 2023-12-07 21:44:03 +01:00
4d0d51e20d move KEY_NAMES to interface.js 2023-12-07 21:43:50 +01:00
e7246c0a5d fix styleSheet change on chrome 2023-12-07 21:29:48 +01:00
50502be1d1 little changes 2023-12-07 21:29:29 +01:00
a89a60691c no wall nound on hard drop 2023-12-07 20:02:43 +01:00
a04e118ff1 reduce blink frequency 2023-12-07 20:00:33 +01:00
16 changed files with 880 additions and 262 deletions

5
README.md Normal file
View File

@ -0,0 +1,5 @@
# Quatuor
Falling blocks
![screenshot](https://git.malingrey.fr/adrien/quatuor/raw/branch/master/thumbnail.png)

276
css/binaural.css Normal file
View File

@ -0,0 +1,276 @@
body {
background-image: url(binaural/bg.jpg),
radial-gradient(
circle at center,
#39444f 0%,
#2c323b 25%,
#293036 28%,
#252b32 34%,
#242930 38%,
#1a1d22 52%,
#191c22 53%,
#151519 63%,
#141418 65%,
#0f0f12 74%,
#0a0c0d 100%
);
background-repeat: round;
}
#sceneDiv {
perspective: 500px;
}
#sceneDiv * {
transform-style: preserve-3d;
}
#screenRow {
display: block;
transform: translateZ(var(--tZ)) rotateX(var(--rX)) rotateY(var(--rY));
cursor: grab;
}
#screenRow:active {
cursor: grabbing;
}
#screenRow * {
display: block;
}
#screenRow .col {
display: inline-block !important;
width: max-content;
height: 100%;
vertical-align: top;
}
.card {
background: #36394180;
}
#matrixCard {
background-image: none;
}
#screenRow .card > * {
transform: translateZ(var(--cell-side));
}
#screenRow .card-header {
background-color: transparent;
border: none;
}
.minoes-table th,
.minoes-table td {
display: inline-block !important;
width: max-content;
}
.minoes-table tr {
width: max-content;
height: var(--cell-side);
}
#statsTable tr {
display: table;
width: 100%;
}
#statsTable th,
#statsTable td {
display: table-cell;
border: 0;
}
tr.matrix td:not(.mino) {
border: 0;
will-change: transform;
transform: translateZ(0);
}
.minoes-table td {
width: var(--cell-side) !important;
height: var(--cell-side);
}
.minoes-table .mino {
background: radial-gradient(circle at -150% -200%, #fffb 0%, var(--background-color) 100%);
overflow: visible;
}
.mino::before,
.mino::after {
content: '';
position: absolute;
display: block;
top: 0;
left: 0;
width: inherit;
height: inherit;
}
.mino::before {
background: var(--light-color);
transform: translateZ(calc(-1 * var(--cell-side))) rotateY(-90deg);
transform-origin: left;
}
.right .mino::before {
background: var(--dark-color);
transform: translateZ(calc(-1 * var(--cell-side))) rotateY(90deg);
transform-origin: right;
}
.mino::after {
background: var(--light-color);
transform: translateZ(calc(-1 * var(--cell-side))) rotateX(90deg);
transform-origin: top;
}
.bottom .mino::after {
background: var(--dark-color);
transform: translateZ(calc(-1 * var(--cell-side))) rotateX(-90deg);
transform-origin: bottom;
}
.I.mino {
--background-color: #42afe1b0;
--light-color: #6ceaff80;
--dark-color: #00a4b0b0;
}
.J.mino {
--background-color: #1165b5b0;
--light-color: #339bff80;
--dark-color: #00009db0;
}
.L.mino {
--background-color: #f38927b0;
--light-color: #ffba5980;
--dark-color: #c54800b0;
}
.O.mino {
--background-color: #f6d03cb0;
--light-color: #ffff7f80;
--dark-color: #ca9501b0;
}
.S.mino {
--background-color: #51b84db0;
--light-color: #84f88080;
--dark-color: #1cbc02b0;
}
.T.mino {
--background-color: #9739a2b0;
--light-color: #d958e980;
--dark-color: #6e019ab0;
}
.Z.mino {
--background-color: #eb4f65b0;
--light-color: #ff7f7980;
--dark-color: #ad1936b0;
}
.ghost.mino {
--background-color: #8886;
--light-color: #ccc6;
--dark-color: #3336;
}
.locking.mino {
--background-color: #eeeb;
--light-color: #fffb;
--dark-color: #dddb;
}
.disabled.mino {
--background-color: #888b;
--light-color: #cccb;
--dark-color: #333b;
}
@keyframes cleared-line-animation {
from {
background-color: #ceffff66;
box-shadow: -200px 0 5px white, 200px 0 5px white;
}
to {
background-color: transparent;
}
}
@keyframes show-level-animation {
from {
opacity: 1;
transform: translateY(200%);
}
50% {
transform: translateY(0) scaleY(1);
line-height: var(--bs-body-line-height);
}
to {
opacity: 1;
transform: translateY(-100%) scaleY(0);
line-height: 0;
}
}
@keyframes zoom-in-animation {
from {
opacity: 1;
transform: scale3d(0.3, 0.3, 0.3);
line-height: var(--bs-body-line-height);
}
30% {
transform: scale3d(1, 1, 1);
}
80% {
transform: scale3d(1, 1, 1);
line-height: var(--bs-body-line-height);
}
to {
opacity: 1;
transform: scale3d(1.5, 0, 1);
line-height: 0;
}
}
@keyframes rotate-in-animation {
0% {
opacity: 1;
transform: rotate(200deg);
line-height: var(--bs-body-line-height);
}
30% {
transform: translateZ(0);
transform: scale3d(1, 1, 1);
}
80% {
transform: scale3d(1, 1, 1);
line-height: var(--bs-body-line-height);
}
to {
opacity: 1;
transform: scale3d(1.5, 0, 1);
line-height: 0;
}
}
@keyframes game-over-animation {
from {
opacity: 1;
transform: translateY(200%);
}
to {
opacity: 1;
transform: translateY(0) scaleY(1);
line-height: var(--bs-body-line-height);
}
}

BIN
css/binaural/bg.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View File

@ -9,85 +9,90 @@
padding: 0; padding: 0;
opacity: 100%; opacity: 100%;
border-radius: 1px; border-radius: 1px;
box-shadow: 2px 2px 4px #000a;
} }
.I.mino { .I.mino {
--background-color: #009FdA; --background-color : #00d6fb;
--frontier-color: #43e7fd; --frontier-color : #43e7fd;
--light-color: #afeff9; --light-color : #afeff9;
border-top-color: #7cf2fd; border-top-color : #7cf2fd;
border-left-color: #2ed5e5; border-left-color : #2ed5e5;
border-right-color: #00b8ca; border-right-color : #01b8ca;
border-bottom-color: #00a4b0; border-bottom-color: #00a4b0;
} }
.J.mino { .J.mino {
--background-color: #2E00FB; --background-color : #2E00FB;
--frontier-color: #7054fb; --frontier-color : #7054fb;
--light-color: #b8b4ff; --light-color : #b8b4ff;
border-top-color: #4985fd; border-top-color : #4985fd;
border-left-color: #2f36ea; border-left-color : #2f36ea;
border-right-color: #0006ca; border-right-color : #0006ca;
border-bottom-color: #00009d; border-bottom-color: #00009d;
} }
.L.mino { .L.mino {
--background-color: #FF7900; --background-color : #FF7900;
--frontier-color: #fe9551; --frontier-color : #fe9551;
--light-color: #fdd0b7; --light-color : #fdd0b7;
border-top-color: #fd9f6b; border-top-color : #fd9f6b;
border-left-color: #e76d28; border-left-color : #e76d28;
border-right-color: #e74f00; border-right-color : #e74f00;
border-bottom-color: #c54800; border-bottom-color: #c54800;
} }
.O.mino { .O.mino {
--background-color: #FeCB00; --background-color : #FeCB00;
--frontier-color: #fce15c; --frontier-color : #fce15c;
--light-color: #ffedac;; --light-color : #ffedac;;
border-top-color: #ffe364; border-top-color : #ffe364;
border-left-color: #e7ba23; border-left-color : #e7ba23;
border-right-color: #e3a707; border-right-color : #e3a707;
border-bottom-color: #ca9501; border-bottom-color: #ca9501;
} }
.S.mino { .S.mino {
--background-color: #67EE12; --background-color : #67EE12;
--frontier-color: #93f85a; --frontier-color : #93f85a;
--light-color: #C8FBA8; --light-color : #C8FBA8;
border-top-color: #a4fc6d; border-top-color : #a4fc6d;
border-left-color: #5ee82b; border-left-color : #5ee82b;
border-right-color: #35db00; border-right-color : #35db00;
border-bottom-color: #1cbc02; border-bottom-color: #1cbc02;
} }
.T.mino { .T.mino {
--background-color: #B000FE; --background-color : #B000FE;
--frontier-color: #c541fc; --frontier-color : #c541fc;
--light-color: #edb2ff; --light-color : #edb2ff;
border-top-color: #d380ff; border-top-color : #d380ff;
border-left-color: #b42deb; border-left-color : #b42deb;
border-right-color: #8000cd; border-right-color : #8000cd;
border-bottom-color: #6e019a; border-bottom-color: #6e019a;
} }
.Z.mino { .Z.mino {
--background-color: #ed2939; --background-color : #ed2939;
--frontier-color: #fe6483; --frontier-color : #fe6483;
--light-color: #ffb8c5; --light-color : #ffb8c5;
border-top-color: #fd718d; border-top-color : #fd718d;
border-left-color: #e62250; border-left-color : #e62250;
border-right-color: #e20332; border-right-color : #e20332;
border-bottom-color: #ad1936; border-bottom-color: #ad1936;
} }
.ghost.mino { .ghost.mino {
background: rgba(0, 0, 0, 10%) !important; margin: 1px;
border: 3px solid rgba(128, 128, 128, 25%) !important; background: transparent !important;
box-shadow: -2px -2px 6px rgba(128, 128, 128, 25%), border: 2px solid var(--light-color) !important;
-2px 2px 6px rgba(128, 128, 128, 25%), box-shadow:
2px -2px 6px rgba(128, 128, 128, 25%), -2px -2px 6px #FFF8,
2px 2px 6px rgba(128, 128, 128, 25%); -2px 2px 6px #FFF8,
2px -2px 6px #FFF8,
2px 2px 6px #FFF8;
opacity: 65%;
} }
.moving.mino { .moving.mino {
@ -96,19 +101,26 @@
.locking.mino { .locking.mino {
filter: saturate(50%) brightness(200%); filter: saturate(50%) brightness(200%);
box-shadow: -1px -1px 4px rgba(128, 128, 128, 25%), box-shadow:
-1px 1px 4px rgba(128, 128, 128, 25%), -1px -1px 4px #FFF2,
1px -1px 4px rgba(128, 128, 128, 25%), -1px 1px 4px #FFF2,
1px 1px 4px rgba(128, 128, 128, 25%); 1px -1px 4px #FFF2,
1px 1px 4px #FFF2;
}
.disabled.mino {
filter: brightness(50%) contrast(80%);
opacity: 70%;
} }
@keyframes locked-animation { @keyframes locked-animation {
from { from {
filter: saturate(50%) brightness(400%); filter: saturate(50%) brightness(400%);
box-shadow: -1px -1px 4px rgba(255, 255, 255, 25%), box-shadow:
-1px 1px 4px rgba(255, 255, 255, 25%), -1px -1px 4px #FFF2,
1px -1px 4px rgba(255, 255, 255, 25%), -1px 1px 4px #FFF2,
1px 1px 4px rgba(255, 255, 255, 25%); 1px -1px 4px #FFF2,
1px 1px 4px #FFF2;
} }
} }

View File

@ -1,6 +1,8 @@
:root { :root {
--cell-side: 24px; --cell-side: 24px;
--rX: -15deg;
--rY: 0;
--tZ: 0;
} }
body { body {
@ -8,20 +10,37 @@ body {
} }
@supports (backdrop-filter: blur()) { @supports (backdrop-filter: blur()) {
.modal {
backdrop-filter: blur(2px);
}
.modal-content { .modal-content {
background-color: rgba(33, 37, 41, 30%); background-color: #2125294d;
backdrop-filter: blur(15px); backdrop-filter: blur(15px);
} }
} }
.card { .card {
background-color: rgb(37, 41, 45); background-color: #25292d;
}
#matrixCard {
background-image: radial-gradient(#222, #25292d)
}
.card-header {
text-shadow: 0 0 2px black;
} }
.modal-title { .modal-title {
text-shadow: 0 0 8px var(--bs-light); text-shadow: 0 0 8px var(--bs-light);
} }
#statsTable td,
#statsModal td {
text-align: right;
}
.minoes-table { .minoes-table {
--piece-column: 0; --piece-column: 0;
--piece-row : 0; --piece-row : 0;
@ -35,19 +54,12 @@ body {
margin-top: calc(-1 * var(--buffer-zone-rows) * var(--cell-side)); margin-top: calc(-1 * var(--buffer-zone-rows) * var(--cell-side));
} }
@keyframes hard-dropped-table-animation { @keyframes hard-dropped-table-animation {
from {
transform: translateY(0);
}
25% { 25% {
transform: translateY(2px); transform: translateY(2px);
} }
to {
transform: translateY(0);
}
} }
#matrixTable.hard-dropped-table-animation { .hard-dropped-table-animation {
animation: hard-dropped-table-animation .2s; animation: hard-dropped-table-animation .2s;
} }
@ -70,7 +82,7 @@ td {
@keyframes trail-animation { @keyframes trail-animation {
from { from {
background-color: rgb(206, 255, 255, 25%); background-color: #ceffff40;
filter: saturate(50%) brightness(300%); filter: saturate(50%) brightness(300%);
} }
to { to {
@ -84,7 +96,7 @@ td.trail-animation {
@keyframes cleared-line-animation { @keyframes cleared-line-animation {
from { from {
background-color: rgb(206, 255, 255, 40%); background-color: #ceffff66;
filter: saturate(50%) brightness(300%); filter: saturate(50%) brightness(300%);
box-shadow: -200px 0 5px white, 200px 0 5px white; box-shadow: -200px 0 5px white, 200px 0 5px white;
} }
@ -97,13 +109,26 @@ tr.cleared-line-animation {
animation: cleared-line-animation ease-out .3s; animation: cleared-line-animation ease-out .3s;
} }
#holdTable .J,
#holdTable .L,
#holdTable .S,
#holdTable .T,
#holdTable .Z,
#nextTable .J,
#nextTable .L,
#nextTable .S,
#nextTable .T,
#nextTable .Z {
transform: translateX(50%);
}
#messagesSpan { #messagesSpan {
position: absolute; position: absolute;
top: 5%; top: 5%;
left: 50%; left: 50%;
transform: translate(-50%, 0); transform: translate(-50%, 0);
color: rgba(255, 255, 255, 0.8); color: #fffc;
text-shadow: 1px 1px rgba(0, 0, 0, 0.8); text-shadow: 1px 1px #000c;
font-size: 3vmin; font-size: 3vmin;
text-align: center; text-align: center;
} }

View File

@ -3,19 +3,30 @@ body {
background-size: cover; background-size: cover;
} }
.card { body[data-bs-theme="dark"] {
background-color: rgba(37, 41, 45, 30%); --bs-body-bg: #2125296b;
} }
.mino:not(.ghost):not(.locking) { .btn-dark {
--bs-btn-bg: #2125296b;
}
.card {
background-color: rgba(37, 41, 45, 40%);
}
tr.matrix td:not(.mino) {
border-left : none;
border-bottom: none;
}
.mino:not(.ghost):not(.locking):not(.disabled) {
padding: 1px; padding: 1px;
position: relative; position: relative;
z-index: 0; z-index: 0;
box-shadow: border-radius: 4px;
-1px -1px 4px rgba(128, 128, 128, 25%), background-color: rgba(128, 128, 128, 25%);
-1px 1px 4px rgba(128, 128, 128, 25%), box-shadow: 0px 0px 8px rgba(128, 128, 128, 75%);
1px -1px 4px rgba(128, 128, 128, 25%),
1px 1px 4px rgba(128, 128, 128, 25%);
} }
.mino:not(.ghost):not(.locking):before { .mino:not(.ghost):not(.locking):before {
@ -23,7 +34,7 @@ body {
position: absolute; position: absolute;
z-index: -1; z-index: -1;
inset: 0; inset: 0;
margin: 1px; margin: 1px 1px 0px 0px;
padding: 2px; padding: 2px;
border-radius: 4px; border-radius: 4px;
--glint-x: calc(50% + 50% * (var(--piece-column) - var(--column))/10); --glint-x: calc(50% + 50% * (var(--piece-column) - var(--column))/10);
@ -37,23 +48,24 @@ body {
linear-gradient(#fff 0 0); linear-gradient(#fff 0 0);
mask-mode: luminance; mask-mode: luminance;
mask-composite: intersect; mask-composite: intersect;
} }
.ghost.mino { .ghost.mino {
background: transparent; background: rgba(242, 255, 255, 10%);
border: 2px solid rgba(255, 255, 255, 0.3); border : 2px solid rgba(255, 255, 255, 0.3);
border-radius: 3px; border-radius: 3px;
box-shadow: box-shadow: 0px 0px 10px rgba(242, 255, 255, 75%);
-1px -1px 8px rgba(242, 255, 255, 32%),
-1px 1px 8px rgba(242, 255, 255, 32%),
1px -1px 8px rgba(242, 255, 255, 32%),
1px 1px 8px rgba(242, 255, 255, 32%);
} }
.moving.mino { .moving.mino {
border-width: 1px; box-shadow: 0px 0px 5px rgba(128, 128, 128, 75%);
background: rgba(186, 211, 255, 30%); }
border-color: rgba(242, 255, 255, 0.7);
.moving.mino:not(.locking) {
padding: 2px;
background: rgba(186, 211, 255, 30%);
border: none;
border-radius: 4px;
} }
.locking.mino { .locking.mino {
@ -61,11 +73,16 @@ body {
background: rgba(186, 211, 255, 70%); background: rgba(186, 211, 255, 70%);
border-color: rgba(242, 255, 255, 0.7); border-color: rgba(242, 255, 255, 0.7);
border-radius: 4px; border-radius: 4px;
box-shadow: box-shadow: 0px 0px 10px rgba(242, 255, 255, 100%);
-1px -1px 8px rgba(186, 211, 255, 27%), }
-1px 1px 8px rgba(186, 211, 255, 27%),
1px -1px 8px rgba(186, 211, 255, 27%), .disabled.mino {
1px 1px 8px rgba(186, 211, 255, 27%); opacity: 60%;
}
.disabled.mino:before {
opacity: 50%;
box-shadow: none;
} }
@keyframes locked-animation { @keyframes locked-animation {

View File

@ -32,42 +32,42 @@ tr.matrix td:not(.mino) {
width: inherit; width: inherit;
height: inherit; height: inherit;
display: block; display: block;
box-shadow: 0 -6px 0 var(--light-color); box-shadow: 0 -6px 0 var(--box-shadow-color);
} }
.I.mino { .I.mino {
--background-color: #42AFE1; --background-color: #42AFE1;
--light-color: #6CEAFF; --box-shadow-color: #6CEAFF;
} }
.J.mino { .J.mino {
--background-color: #1165B5; --background-color: #1165B5;
--light-color: #339BFF; --box-shadow-color: #339BFF;
} }
.L.mino { .L.mino {
--background-color: #F38927; --background-color: #F38927;
--light-color: #FFBA59; --box-shadow-color: #FFBA59;
} }
.O.mino { .O.mino {
--background-color: #F6D03C; --background-color: #F6D03C;
--light-color: #FFFF7F; --box-shadow-color: #FFFF7F;
} }
.S.mino { .S.mino {
--background-color: #51B84D; --background-color: #51B84D;
--light-color: #84F880; --box-shadow-color: #84F880;
} }
.T.mino { .T.mino {
--background-color: #9739A2; --background-color: #9739A2;
--light-color: #D958E9; --box-shadow-color: #D958E9;
} }
.Z.mino { .Z.mino {
--background-color: #EB4F65; --background-color: #EB4F65;
--light-color: #FF7F79; --box-shadow-color: #FF7F79;
} }
.ghost.mino { .ghost.mino {
@ -88,6 +88,10 @@ tr.matrix td:not(.mino) {
animation-duration: 0.2s; animation-duration: 0.2s;
} }
.disabled.mino {
filter: brightness(50%) contrast(50%);
}
@keyframes locked-animation { @keyframes locked-animation {
from { from {
filter: saturate(50%) brightness(300%); filter: saturate(50%) brightness(300%);

155
css/opera.css Normal file
View File

@ -0,0 +1,155 @@
body {
--bs-gutter-x: 0;
background: black !important;
}
#screenRow {
gap: 0 !important;
margin: 0;
text-transform: uppercase;
letter-spacing: .1em;
}
#screenRow {
--bs-gutter-x: 0;
}
.card {
background: black;
border: none;
border-radius: 0;
margin-bottom: 0.5em !important;
}
.card-header,
.card-header th{
background: transparent;
font-weight: 400 !important;
font-size: 1.3em;
border: none;
}
#screenRow .table {
--bs-border-width: 0;
}
#holdTable {
margin: 0 0 0 auto !important;
}
#holdTable,
#nextTable {
border-bottom: 2px solid white;
}
#statsTable {
margin-right: 1.5em;
}
#statsTable tr {
display: flex;
flex-flow: column;
align-items: center;
}
#statsTable td,
#statsTable th {
margin: 0;
padding: 0 !important;
width: auto;
height: auto;
text-transform: uppercase;
}
#statsTable th {
display: inline;
flex-flow: row;
font-size: 0.8em;
text-align: center;
width: 200%;
}
#statsTable td {
font-size: 1.3em;
font-weight: 600;
color: white;
}
#matrixCard {
background: transparent;
border-top: none;
border-left: 4px solid white;
border-right: 4px solid white;
border-bottom: 4px solid white;
}
.mino {
padding: 0;
opacity: 100%;
border-width: 1px;
border-style: solid;
}
.I.mino {
background-color: #42AFE1;
border-color: #6CEAFF;
}
.J.mino {
background-color: #1165B5;
border-color: #339BFF;
}
.L.mino {
background-color: #F38927;
border-color: #FFBA59;
}
.O.mino {
background-color: #F6D03C;
border-color: #FFFF7F;
}
.S.mino {
background-color: #32ee3e;
border-color: #84F880;
}
.T.mino {
background-color: #9739A2;
border-color: #D958E9;
}
.Z.mino {
background-color: #EB4F65;
border-color: #FF7F79;
}
.ghost.mino {
background-color: #fff4;
border-color: #fff8;
}
.moving.mino {
filter: saturate(80%) brightness(150%);
}
.locking.mino {
filter: saturate(50%) brightness(200%);
}
.disabled.mino {
filter: brightness(50%) contrast(80%);
opacity: 70%;
}
@keyframes locked-animation {
from {
filter: saturate(50%) brightness(400%);
}
}
.locked.mino {
animation: locked-animation;
animation-duration: 0.2s;
}

View File

@ -3,64 +3,71 @@ body {
background-size: cover; background-size: cover;
} }
.card { body[data-bs-theme="dark"] {
--bs-body-bg: #2125296b;
}
.btn-dark {
--bs-btn-bg: #2125296b;
}
.card,
#matrixCard {
background: repeating-linear-gradient(transparent, #111 1px);
backdrop-filter: blur(3px);
}
.card-header {
background-color: rgba(37, 41, 45, 50%); background-color: rgba(37, 41, 45, 50%);
} }
@supports (backdrop-filter: blur()) { #matrixTable {
.card { border-spacing: 1px;
background-color: rgba(33, 37, 41, 20%);
backdrop-filter: blur(3px);
}
} }
tr.matrix td:not(.mino) { tr.matrix td:not(.mino) {
border-left : 1px solid #222; border: 1px solid #111;
border-right : 1px solid #222;
border-top : 1px solid #111;
border-bottom: 1px solid #111;
} }
.mino { .mino {
background: rgba(255, 255, 255, 33%); background: radial-gradient(#fff3 0%, var(--color) 170%);
border: 6px solid var(--color); border: 2px solid var(--color);
padding: 0; border-radius: 0;
outline: 1px solid #0006;
opacity: 100%; opacity: 100%;
border-radius: 4px; box-shadow: 0 0 12px var(--color);
filter: blur(1px);
box-shadow: 0 0 10px var(--color);
} }
.I.mino { .I.mino {
--color: #9bf6ff; --color: #00eaf5;
} }
.J.mino { .J.mino {
--color: #a0c4ff; --color: #00a9f7;
} }
.L.mino { .L.mino {
--color: #ffd6a5; --color: #f9b600;
} }
.O.mino { .O.mino {
--color: #fdffb6; --color: #f7f200;;
} }
.T.mino { .T.mino {
--color: #bdb2ff; --color: #d136e2;;
} }
.S.mino { .S.mino {
--color: #caffbf; --color: #35da3f;
} }
.Z.mino { .Z.mino {
--color: #ffadad; --color: #ee3b3a;
} }
.ghost.mino { .ghost.mino {
filter: brightness(150%) blur(2px); background: transparent;
opacity: 50%; opacity: 50%;
} }
@ -70,7 +77,7 @@ tr.matrix td:not(.mino) {
.locking.mino { .locking.mino {
--color: white; --color: white;
filter: blur(2px); box-shadow: 0 0 10px var(--color);
} }
@keyframes locked-animation { @keyframes locked-animation {
@ -85,13 +92,32 @@ tr.matrix td:not(.mino) {
animation-duration: 0.2s; animation-duration: 0.2s;
} }
.disabled.mino {
outline: 0px;
box-shadow: none;
filter: contrast(40%) brightness(50%);
}
tr.cleared-line-animation {
animation: none;
}
tr.cleared-line-animation::after {
content: "";
width: 100%;
height: var(--cell-side);
position: fixed;
left: 50%;
transform: translateX(-50%);
display: block;
background: repeating-linear-gradient(transparent, #fffb 1px);
opacity: 0;
animation: cleared-line-animation ease-out .3s;
}
@keyframes cleared-line-animation { @keyframes cleared-line-animation {
from { 25% {
background-color: rgb(206, 255, 255, 40%); width: 200%;
filter: saturate(50%) brightness(300%); opacity: 100%;
box-shadow: -200px 0 10px white, 200px 0 10px white;
}
to {
box-shadow: -200px 0 50px transparent, 200px 0 50px transparent;
} }
} }

View File

@ -7,6 +7,9 @@
src: url("retro/Early GameBoy.ttf"); src: url("retro/Early GameBoy.ttf");
} }
body {
}
#screenRow { #screenRow {
background-image: url("retro/bg.png"); background-image: url("retro/bg.png");
background-size: 10px; background-size: 10px;
@ -45,8 +48,11 @@
#statsTable, #statsTable,
.card, .card,
.card-header,
#messagesSpan { #messagesSpan {
font-family: "Early GameBoy", monospace; font-family: "Early GameBoy", monospace;
font-smooth: never;
-webkit-font-smoothing: none;
color: #254806; color: #254806;
text-shadow: -1px -1px 3px rgba(0, 0, 0, 40%), 1px 1px 1px rgba(0, 0, 0, 40%); text-shadow: -1px -1px 3px rgba(0, 0, 0, 40%), 1px 1px 1px rgba(0, 0, 0, 40%);
} }
@ -120,10 +126,11 @@ td {
} }
.locking.mino { .locking.mino {
animation: blinker 0.04s step-start infinite; animation: blinker 0.08s step-start infinite;
} }
.ghost.mino { .ghost.mino,
.disabled.mino {
opacity: 50%; opacity: 50%;
} }
@ -131,11 +138,15 @@ td {
animation: none; animation: none;
} }
.hard-dropped-table-animation {
animation: hard-dropped-table-animation steps(1) .2s;
}
@keyframes cleared-line-animation { @keyframes cleared-line-animation {
5%, 15%, 25%, 35%, 45%, 55%, 65%, 75%, 85%, 95% { 10%, 30%, 50%, 70%, 90% {
opacity: 0; opacity: 0;
} }
10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90% { 20%, 40%, 60%, 80% {
opacity: 100%; opacity: 100%;
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 KiB

View File

@ -4,20 +4,32 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>Quatuor</title> <title>Quatuor</title>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="dark"> <meta name="color-scheme" content="dark">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.4/font/bootstrap-icons.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.4/font/bootstrap-icons.css">
<link rel="stylesheet" href="css/common.css"> <link rel="stylesheet" href="css/common.css">
<link rel="stylesheet" href="css/classic.css" title="Classique"> <link rel="stylesheet" href="css/classic.css" title="Thème sélectionné" id="selectedStyleSheet">
<link rel="alternate stylesheet" href="css/classic.css" title="Classique">
<link rel="alternate stylesheet" href="css/minimal.css" title="Minimal"> <link rel="alternate stylesheet" href="css/minimal.css" title="Minimal">
<link rel="alternate stylesheet" href="css/electro.css" title="Électro"> <link rel="alternate stylesheet" href="css/electro.css" title="Électro">
<link rel="alternate stylesheet" href="css/pop.css" title="Pop"> <link rel="alternate stylesheet" href="css/pop.css" title="Pop">
<link rel="alternate stylesheet" href="css/retro.css" title="Rétro"> <link rel="alternate stylesheet" href="css/retro.css" title="Rétro">
<link rel="apple-touch-icon" sizes="180x180" href="favicons/apple-touch-icon.png"> <link rel="alternate stylesheet" href="css/opera.css" title="Opéra">
<link rel="icon" type="image/png" sizes="32x32" href="favicons/T-2.png"> <link rel="alternate stylesheet" href="css/binaural.css" title="Binaural">
<link rel="icon" type="image/png" sizes="16x16" href="favicons/favicon-16x16.png"> <link rel="apple-touch-icon" sizes="180x180" href="favicons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="favicons/T-2.png">
<link rel="icon" type="image/png" sizes="16x16" href="favicons/favicon-16x16.png">
<link rel="manifest" href="manifest.json"> <link rel="manifest" href="manifest.json">
<meta property="og:title" content="Quatuor"/>
<meta property="og:type" content="game"/>
<meta property="og:url" content="https://adrien.malingrey.fr/jeux/quatuor/"/>
<meta property="og:image" content="https://adrien.malingrey.fr/jeux/quatuor/thumbnail.png"/>
<meta property="og:image:width" content="288"/>
<meta property="og:image:height" content="288"/>
<meta property="og:description" content="Un jeu avec un quatuor de blocs qui tombent."/>
<meta property="og:locale" content="fr_FR"/>
<meta property="og:site_name" content="adrien.malingrey.fr"/>
</head> </head>
<body data-bs-theme="dark"> <body data-bs-theme="dark">
@ -30,47 +42,45 @@
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form name="settingsForm" class="needs-validation" novalidate> <form name="settingsForm" class="needs-validation" novalidate>
<fieldset id="keyBindFielset" class="row g-2 mb-3 align-items-center text-center"> <fieldset id="keyBindFielset" class="row g-2 mb-3 align-items-center text-center"><legend class="text-start">Commandes</legend>
<legend class="text-start">Commandes</legend>
<label for="moveLeftInput" title="Gauche" class="col-2 col-form-label d-flex align-items-center justify-content-center"><i class="bi bi-arrow-left"></i></label> <label for="moveLeftInput" title="Gauche" class="col-2 col-form-label d-flex align-items-center justify-content-center"><i class="bi bi-arrow-left"></i></label>
<div class="col-4"><input name="moveLeft" id="moveLeftInput" type="text" class="form-control text-center btn btn-dark" value="←" onclick="changeKey(this)" placeholder="Touche ?" title="Modifier la touche" required></div> <div class="col-4"><input name="moveLeft" id="moveLeftInput" type="text" class="form-control text-center" value="←" onfocus="changeKey(this)" placeholder="Touche ?" title="Modifier la touche" required></div>
<div class="col-4"><input name="moveRight" id="moveRightInput" type="text" class="form-control text-center btn btn-dark" value="→" onclick="changeKey(this)" placeholder="Touche ?" title="Modifier la touche" required></div> <div class="col-4"><input name="moveRight" id="moveRightInput" type="text" class="form-control text-center" value="→" onfocus="changeKey(this)" placeholder="Touche ?" title="Modifier la touche" required></div>
<label for="moveRightInput" title="Droite" class="col-2 col-form-label d-flex align-items-center justify-content-center"><i class="bi bi-arrow-right"></i></label> <label for="moveRightInput" title="Droite" class="col-2 col-form-label d-flex align-items-center justify-content-center"><i class="bi bi-arrow-right"></i></label>
<label for="rotateCounterclockwiseInput" title="Rotation anti-horaire" class="col-2 col-form-label d-flex align-items-center justify-content-center"><i class="bi bi-arrow-counterclockwise"></i></label> <label for="rotateCounterclockwiseInput" title="Rotation anti-horaire" class="col-2 col-form-label d-flex align-items-center justify-content-center"><i class="bi bi-arrow-counterclockwise"></i></label>
<div class="col-4"><input name="rotateCounterclockwise" id="rotateCounterclockwiseInput" type="text" class="form-control text-center btn btn-dark" value="w" onclick="changeKey(this)" placeholder="Touche ?" title="Modifier la touche" required></div> <div class="col-4"><input name="rotateCounterclockwise" id="rotateCounterclockwiseInput" type="text" class="form-control text-center" value="w" onfocus="changeKey(this)" placeholder="Touche ?" title="Modifier la touche" required></div>
<div class="col-4"><input name="rotateClockwise" id="rotateClockwiseInput" type="text" class="form-control text-center btn btn-dark" value="↑" onclick="changeKey(this)" placeholder="Touche ?" title="Modifier la touche" required></div> <div class="col-4"><input name="rotateClockwise" id="rotateClockwiseInput" type="text" class="form-control text-center" value="↑" onfocus="changeKey(this)" placeholder="Touche ?" title="Modifier la touche" required></div>
<label for="rotateClockwiseInput" title="Rotation horaire" class="col-2 col-form-label d-flex align-items-center justify-content-center"><i class="bi bi-arrow-clockwise"></i></label> <label for="rotateClockwiseInput" title="Rotation horaire" class="col-2 col-form-label d-flex align-items-center justify-content-center"><i class="bi bi-arrow-clockwise"></i></label>
<label for="softDropInput" title="Chute lente" class="col-2 col-form-label d-flex align-items-center justify-content-center"><i class="bi bi-arrow-down-short"></i></label> <label for="softDropInput" title="Chute lente" class="col-2 col-form-label d-flex align-items-center justify-content-center"><i class="bi bi-arrow-down-short"></i></label>
<div class="col-4"><input name="softDrop" id="softDropInput" type="text" class="form-control text-center btn btn-dark" value="↓" onclick="changeKey(this)" placeholder="Touche ?" title="Modifier la touche" required></div> <div class="col-4"><input name="softDrop" id="softDropInput" type="text" class="form-control text-center" value="↓" onfocus="changeKey(this)" placeholder="Touche ?" title="Modifier la touche" required></div>
<div class="col-4"><input name="hardDrop" id="hardDropInput" type="text" class="form-control text-center btn btn-dark" value="Espace" onclick="changeKey(this)" placeholder="Touche ?" title="Modifier la touche" required></div> <div class="col-4"><input name="hardDrop" id="hardDropInput" type="text" class="form-control text-center" value="Espace" onfocus="changeKey(this)" placeholder="Touche ?" title="Modifier la touche" required></div>
<label for="hardDropInput" title="Chute rapide" class="col-2 col-form-label d-flex align-items-center justify-content-center"><i class="bi bi-download"></i></label> <label for="hardDropInput" title="Chute rapide" class="col-2 col-form-label d-flex align-items-center justify-content-center"><i class="bi bi-download"></i></label>
<label for="holdInput" title="Échanger la pièce" class="col-2 col-form-label d-flex align-items-center justify-content-center"><i class="bi bi-arrow-left-right"></i></label> <label for="holdInput" title="Échanger la pièce" class="col-2 col-form-label d-flex align-items-center justify-content-center"><i class="bi bi-arrow-left-right"></i></label>
<div class="col-4"><input name="hold" id="holdInput" type="text" class="form-control text-center btn btn-dark" value="c" onclick="changeKey(this)" placeholder="Touche ?" title="Modifier la touche" required></div> <div class="col-4"><input name="hold" id="holdInput" type="text" class="form-control text-center" value="c" onfocus="changeKey(this)" placeholder="Touche ?" title="Modifier la touche" required></div>
<div class="col-4"><input name="pause" id="pauseInput" type="text" class="form-control text-center btn btn-dark" value="Échap." onclick="changeKey(this)" placeholder="Touche ?" title="Modifier la touche" required></div> <div class="col-4"><input name="pause" id="pauseInput" type="text" class="form-control text-center" value="Échap." onfocus="changeKey(this)" placeholder="Touche ?" title="Modifier la touche" required></div>
<label for="pauseInput" title="Pause" class="col-2 col-form-label d-flex align-items-center justify-content-center"><i class="bi bi-pause"></i></label> <label for="pauseInput" title="Pause" class="col-2 col-form-label d-flex align-items-center justify-content-center"><i class="bi bi-pause"></i></label>
</fieldset> </fieldset>
<fieldset id="autorepeatFieldset" class="row g-2 mb-3 align-items-center text-center"> <fieldset id="autorepeatFieldset" class="row g-2 mb-3 align-items-center text-center"><legend class="text-start">Répétition automatique</legend>
<legend class="text-start">Répétition automatique</legend>
<label for="arrInput" class="col-2 col-form-label"><abbr title="Automatic Repeat Rate : période de répétition de l'action">ARR</abbr></label> <label for="arrInput" class="col-2 col-form-label"><abbr title="Automatic Repeat Rate : période de répétition de l'action">ARR</abbr></label>
<div class="col-4"><div class="input-group"><input name="arr" id="arrInput" type="number" class="form-control text-center" value="50" min="2" max="200" step="1"><div class="input-group-text">ms</div></div></div> <div class="col-4"><div class="input-group"><input name="arr" id="arrInput" type="number" class="form-control text-center" value="50" min="2" max="200" step="1"><div class="input-group-text">ms</div></div></div>
<div class="col-4"><div class="input-group"><input name="das" id="dasInput" type="number" class="form-control text-center" value="300" min="100" max="500" step="5"><div class="input-group-text">ms</div></div></div> <div class="col-4"><div class="input-group"><input name="das" id="dasInput" type="number" class="form-control text-center" value="300" min="100" max="500" step="5"><div class="input-group-text">ms</div></div></div>
<label for="dasInput" class="col-2 col-form-label"><abbr title="Delayed AutoShift : délai initial avant répétition">DAS</abbr></label> <label for="dasInput" class="col-2 col-form-label"><abbr title="Delayed AutoShift : délai initial avant répétition">DAS</abbr></label>
</fieldset> </fieldset>
<fieldset class="row g-2 mb-3 align-items-center text-center"> <fieldset class="row g-2 mb-3 align-items-center text-center"><legend class="text-start">Interface</legend>
<legend class="text-start">Interface</legend>
<label for="stylesheetSelect" class="col-2 col-form-label">Thème</label> <label for="stylesheetSelect" class="col-2 col-form-label">Thème</label>
<div class="col-4"><select name="stylesheet" id="stylesheetSelect" class="form-select" oninput="document.selectedStyleSheetSet=this.value"> <div class="col-4"><select name="stylesheet" id="stylesheetSelect" class="form-select" oninput="selectedStyleSheet.href = this.value">
<option selected>Classique</option> <option value="css/classic.css" selected>Classique</option>
<option>Minimal</option> <option value="css/minimal.css">Minimal</option>
<option>Pop</option> <option value="css/pop.css">Pop</option>
<option>Électro</option> <option value="css/electro.css">Électro</option>
<option>Rétro</option> <option value="css/retro.css">Rétro</option>
<option value="css/opera.css">Opéra</option>
<option value="css/binaural.css">Binaural</option>
</select></div> </select></div>
<div class="col-4 d-flex align-items-baseline"><input id="sfxVolumeRange" class="form-range" type="range" min="0" max="1" step="any" value="0.7"></div> <div class="col-4 d-flex align-items-baseline"><input name="sfxVolumeRange" id="sfxVolumeRange" class="form-range" type="range" min="0" max="1" step="any" value="0.7"></div>
<label for="sfxVolumeRange" class="col-2 col-form-label">Volume</label> <label for="sfxVolumeRange" class="col-2 col-form-label">Volume</label>
</fieldset> </fieldset>
<fieldset class="row g-2 mb-3 align-items-center text-center"> <fieldset class="row g-2 mb-3 align-items-center text-center"><legend class="text-start">Partie</legend>
<legend class="text-start">Partie</legend>
<label for="levelInput" class="col-2 col-form-label text-center">Niveau</label> <label for="levelInput" class="col-2 col-form-label text-center">Niveau</label>
<div class="col-4"> <div class="col-4">
<input name="startLevel" id="levelInput" type="number" class="form-control text-center" value="1" min="1" max="15"> <input name="startLevel" id="levelInput" type="number" class="form-control text-center" value="1" min="1" max="15">
@ -85,14 +95,14 @@
</div> </div>
</div> </div>
<div class="container-fluid d-flex vh-100 justify-content-center d-flex align-items-center"> <div id="sceneDiv" class="container-fluid d-flex vh-100 justify-content-center d-flex align-items-center">
<div id="screenRow" class="row row-cols-auto align-items-start gap-2"> <div id="screenRow" class="row row-cols-auto align-items-start gap-2">
<div class="col d-flex flex-column align-items-end"> <div class="col d-flex flex-column align-items-end">
<div class="card mb-4"> <div class="card shadow mb-4 w-100">
<div class="card-header text-center"><strong>HOLD</strong></div> <div class="card-header fw-bold text-uppercase text-center">Hold</div>
<div class="card-body p-0"> <div class="card-body p-0">
<table id="holdTable" class="minoes-table"> <table id="holdTable" class="minoes-table m-auto">
<tr class="buffer-zone"><td></td><td></td><td></td><td></td><td></td><td></td></tr> <tr class="buffer-zone"><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr class="buffer-zone"><td></td><td></td><td></td><td></td><td></td><td></td></tr> <tr class="buffer-zone"><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr class="buffer-zone"><td></td><td></td><td></td><td></td><td></td><td></td></tr> <tr class="buffer-zone"><td></td><td></td><td></td><td></td><td></td><td></td></tr>
@ -103,11 +113,11 @@
</div> </div>
<div class="card shadow"> <div class="card shadow">
<table id="statsTable" class="table mb-0"> <table id="statsTable" class="table mb-0">
<tr><th>Score</th> <td id="scoreCell">0</td> </tr> <tr class="card-header fw-bold text-uppercase"><th>Score</th><td id="scoreCell">0</td> </tr>
<tr><th>Meilleur<br/>score</th><td id="highScoreCell"><script>document.write(Number(localStorage["highScore"]) || 0)</script></td></tr> <tr><th>Meilleur<br/>score</th><td id="highScoreCell"><script>document.write(Number(localStorage["highScore"]) || 0)</script></td></tr>
<tr><th>Niveau</th><td id="levelCell">0</td> </tr> <tr><th>Niveau</th> <td id="levelCell">0</td> </tr>
<tr><th>But</th> <td id="goalCell">0</td> </tr> <tr><th>But</th> <td id="goalCell">0</td> </tr>
<tr><th>Temps</th> <td id="timeCell">00:00</td> </tr> <tr><th>Temps</th> <td id="timeCell">00:00</td> </tr>
</table> </table>
</div> </div>
</div> </div>
@ -149,7 +159,7 @@
<div class="col"> <div class="col">
<div class="card shadow"> <div class="card shadow">
<div class="card-header text-center"><strong>NEXT</strong></div> <div class="card-header fw-bold text-uppercase text-center">Next</div>
<div class="card-body p-0"> <div class="card-body p-0">
<table id="nextTable" class="minoes-table caption-top"> <table id="nextTable" class="minoes-table caption-top">
<tr class="buffer-zone"><td></td><td></td><td></td><td></td><td></td><td></td></tr> <tr class="buffer-zone"><td></td><td></td><td></td><td></td><td></td><td></td></tr>
@ -186,11 +196,11 @@
</div> </div>
<div class="modal-body p-0"> <div class="modal-body p-0">
<table class="table mb-0"> <table class="table mb-0">
<tr><th>Score </th><td id="statsModalScoreCell"> </td><th>Niveau </th><td id="statsModalLevelCell"> </td></tr> <tr><th>Score</th> <td id="statsModalScoreCell"></td> <th>Niveau</th> <td id="statsModalLevelCell"></td> </tr>
<tr><th>Meilleur score</th><td id="statsModalHighScoreCell"> </td><th>Temps </th><td id="statsModalTimeCell"> </td></tr> <tr><th>Meilleur score</th><td id="statsModalHighScoreCell"></td> <th>Temps</th> <td id="statsModalTimeCell"></td> </tr>
<tr><th>Lignes </th><td id="statsModaltotalClearedLines"></td><th>Lignes par minute </th><td id="statsModaltotalClearedLinesPM"></td></tr> <tr><th>Lignes</th> <td id="statsModaltotalClearedLines"></td><th>Lignes par minute</th> <td id="statsModaltotalClearedLinesPM"></td></tr>
<tr><th>Quatuors </th><td id="statsModalNbQuatuors"> </td><th>Plus long combo </th><td id="statsModalMaxCombo"> </td></tr> <tr><th>Quatuors</th> <td id="statsModalNbQuatuors"></td> <th>Plus long combo</th> <td id="statsModalMaxCombo"></td> </tr>
<tr><th>Pirouettes </th><td id="statsModalNbTSpin"> </td><th>Plus long bout en bout</th><td id="statsModalMaxB2B"> </td></tr> <tr><th>Pirouettes</th> <td id="statsModalNbTSpin"></td> <th>Plus long bout en bout</th><td id="statsModalMaxB2B"></td> </tr>
</table> </table>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
@ -221,8 +231,6 @@
<script src="js/game_logic.js" language="Javascript" type="text/javascript"></script> <script src="js/game_logic.js" language="Javascript" type="text/javascript"></script>
<script src="js/interface.js" language="Javascript" type="text/javascript"></script> <script src="js/interface.js" language="Javascript" type="text/javascript"></script>
<script src="js/app.js" language="Javascript" type="text/javascript"></script> <script src="js/app.js" language="Javascript" type="text/javascript"></script>
<script> <script>navigator?.serviceWorker.register('js/service-worker.js')</script>
</script>
</body> </body>
</html> </html>

107
js/app.js
View File

@ -1,15 +1,16 @@
let scheduler = new Scheduler() let scheduler = new Scheduler()
let settings = new Settings() let settings = new Settings()
let stats = new Stats() let stats = new Stats()
let holdQueue = new MinoesTable("holdTable") let holdQueue = new HoldQueue()
let matrix = new Matrix() let matrix = new Matrix()
let nextQueue = new NextQueue() let nextQueue = new NextQueue()
let playing = false let playing = false
let lastActionSucceded = true //let lastActionSucceded = true
let favicon let favicon
window.onload = function(event) { window.onload = function(event) {
document.selectedStyleSheetSet = stylesheetSelect.value document.selectedStyleSheetSet = selectedStyleSheet.title
selectedStyleSheet.href = stylesheetSelect.value
favicon = document.querySelector("link[rel~='icon']") favicon = document.querySelector("link[rel~='icon']")
restart() restart()
@ -18,6 +19,7 @@ window.onload = function(event) {
function restart() { function restart() {
stats.modal.hide() stats.modal.hide()
holdQueue.init() holdQueue.init()
holdQueue.redraw()
stats.init() stats.init()
matrix.init() matrix.init()
nextQueue.init() nextQueue.init()
@ -95,7 +97,8 @@ function ticktack() {
function generate(piece) { function generate(piece) {
matrix.piece = piece || nextQueue.shift() matrix.piece = piece || nextQueue.shift()
lastActionSucceded = true if (!piece && holdQueue.piece) holdQueue.drawPiece()
//lastActionSucceded = true
favicon.href = matrix.piece.favicon_href favicon.href = matrix.piece.favicon_href
if (matrix.piece.canMove(TRANSLATION.NONE)) { if (matrix.piece.canMove(TRANSLATION.NONE)) {
@ -119,8 +122,8 @@ let playerActions = {
hardDrop: function() { hardDrop: function() {
scheduler.clearTimeout(lockDown) scheduler.clearTimeout(lockDown)
playSound(hardDropSound) playSound(hardDropSound)
while (matrix.piece.move(TRANSLATION.DOWN, ROTATION.NONE, true)) stats.score +=2 while (matrix.piece.move(TRANSLATION.DOWN, ROTATION.NONE, true)) stats.score += 2
matrix.table.classList.add("hard-dropped-table-animation") matrixCard.classList.add("hard-dropped-table-animation")
lockDown() lockDown()
return true return true
}, },
@ -130,13 +133,12 @@ let playerActions = {
scheduler.clearInterval(fall) scheduler.clearInterval(fall)
scheduler.clearTimeout(lockDown) scheduler.clearTimeout(lockDown)
let heldPiece = holdQueue.piece let piece = matrix.piece
matrix.piece.facing = FACING.NORTH piece.facing = FACING.NORTH
matrix.piece.locked = false piece.locked = false
holdQueue.piece = matrix.piece generate(holdQueue.piece)
holdQueue.piece.holdEnabled = false matrix.piece.holdEnabled = false
holdQueue.piece.locked = false holdQueue.piece = piece
generate(heldPiece)
} }
}, },
@ -158,12 +160,13 @@ function onkeydown(event) {
if (!pressedKeys.has(event.key)) { if (!pressedKeys.has(event.key)) {
pressedKeys.add(event.key) pressedKeys.add(event.key)
action = settings.keyBind[event.key] action = settings.keyBind[event.key]
if (action()) { /*if (action()) {
lastActionSucceded = true lastActionSucceded = true
} else if (lastActionSucceded || !(action in REPEATABLE_ACTIONS)) { } else if (lastActionSucceded || !(action in REPEATABLE_ACTIONS)) {
wallSound.play() playSound(wallSound)
lastActionSucceded = false lastActionSucceded = false
} }*/
action()
if (REPEATABLE_ACTIONS.includes(action)) { if (REPEATABLE_ACTIONS.includes(action)) {
actionsQueue.unshift(action) actionsQueue.unshift(action)
scheduler.clearTimeout(repeat) scheduler.clearTimeout(repeat)
@ -185,12 +188,13 @@ function repeat() {
function autorepeat() { function autorepeat() {
if (actionsQueue.length) { if (actionsQueue.length) {
if (actionsQueue[0]()) { /*if (actionsQueue[0]()) {
lastActionSucceded = true lastActionSucceded = true
} else if (lastActionSucceded) { } else if (lastActionSucceded) {
wallSound.play() wallSound.play()
lastActionSucceded = false lastActionSucceded = false
} }*/
actionsQueue[0]()
} }
else scheduler.clearInterval(autorepeat) else scheduler.clearInterval(autorepeat)
} }
@ -202,9 +206,12 @@ function onkeyup(event) {
action = settings.keyBind[event.key] action = settings.keyBind[event.key]
if (actionsQueue.includes(action)) { if (actionsQueue.includes(action)) {
actionsQueue.splice(actionsQueue.indexOf(action), 1) actionsQueue.splice(actionsQueue.indexOf(action), 1)
if (!actionsQueue.length) { scheduler.clearTimeout(repeat)
scheduler.clearTimeout(repeat) scheduler.clearInterval(autorepeat)
scheduler.clearInterval(autorepeat) if (actionsQueue.length) {
if (actionsQueue[0] == playerActions.softDrop) scheduler.setInterval(autorepeat, settings.fallPeriod/20)
else scheduler.setTimeout(repeat, settings.das)
} else {
matrix.drawPiece() matrix.drawPiece()
} }
} }
@ -218,12 +225,9 @@ function fall() {
function lockDown() { function lockDown() {
scheduler.clearTimeout(lockDown) scheduler.clearTimeout(lockDown)
scheduler.clearInterval(fall) scheduler.clearInterval(fall)
if (lastActionSucceded) wallSound.play()
if (matrix.lock()) { if (matrix.lock()) {
let tSpin = matrix.piece.tSpin stats.lockDown(matrix.piece.tSpin, matrix.clearLines())
let nbClearedLines = matrix.clearLines()
stats.lockDown(nbClearedLines, tSpin)
generate() generate()
} else { } else {
@ -240,7 +244,7 @@ messagesSpan.onanimationend = function(event) {
} }
function gameOver() { function gameOver() {
matrix.piece.locked = false matrix.piece.locked = true
matrix.drawPiece() matrix.drawPiece()
document.onkeydown = null document.onkeydown = null
@ -257,7 +261,54 @@ window.onbeforeunload = function(event) {
if (playing) return false; if (playing) return false;
} }
// Play with 3D
let mousedown = false
let rX0 = 0
let rY0 = 0
let clientX0 = 0
let clientY0 = 0
if ('serviceWorker' in navigator) { sceneDiv.onmousedown = function(event) {
navigator.serviceWorker.register('service-worker.js'); mousedown = true
rX0 = parseInt(getComputedStyle(screenRow).getPropertyValue("--rX"))
dy0 = parseInt(getComputedStyle(screenRow).getPropertyValue("--rY"))
clientX0 = event.clientX
clientY0 = event.clientY
}
sceneDiv.onmousemove = function(event) {
if (mousedown) {
event.preventDefault()
event.stopPropagation()
rX = (rX0 - event.clientY + clientY0 + 360) % 360
screenRow.style.setProperty("--rX", rX + "deg")
if (rX <= 180) {
screenRow.classList.remove("top")
screenRow.classList.add("bottom")
} else {
screenRow.classList.add("top")
screenRow.classList.remove("bottom")
}
rY = (rY0 + event.clientX - clientX0 + 360) % 360
screenRow.style.setProperty("--rY", rY + "deg")
if (rY >= 180) {
screenRow.classList.remove("left")
screenRow.classList.add("right")
} else {
screenRow.classList.add("left")
screenRow.classList.remove("right")
}
}
}
sceneDiv.onmouseup = document.onmouseleave = function(event) {
mousedown = false
}
sceneDiv.onwheel = function(event) {
event.preventDefault()
event.stopPropagation()
let tZ = parseInt(getComputedStyle(screenRow).getPropertyValue("--tZ"))
tZ += event.deltaY
screenRow.style.setProperty("--tZ", tZ + "px")
} }

View File

@ -44,29 +44,6 @@ const FACING = {
WEST: 3, WEST: 3,
} }
const KEY_NAMES = new Proxy({
["ArrowLeft"] : "←",
["←"] : "ArrowLeft",
["ArrowRight"] : "→",
["→"] : "ArrowRight",
["ArrowUp"] : "↑",
["↑"] : "ArrowUp",
["ArrowDown"] : "↓",
["↓"] : "ArrowDown",
[" "] : "Espace",
["Espace"] : " ",
["Escape"] : "Échap.",
["Échap."] : "Escape",
["Backspace"] : "Ret. arrière",
["Ret. arrière"]: "Backspace",
["Enter"] : "Entrée",
["Entrée"] : "Enter",
}, {
get(obj, keyName) {
return keyName in obj? obj[keyName] : keyName
}
})
/* Customize Array to be use as position */ /* Customize Array to be use as position */
Object.defineProperties(Array.prototype, { Object.defineProperties(Array.prototype, {
"x": { "x": {
@ -194,6 +171,20 @@ class MinoesTable {
MinoesTable.prototype.init_center = [2, 2] MinoesTable.prototype.init_center = [2, 2]
class HoldQueue extends MinoesTable {
constructor() {
super("holdTable")
}
drawPiece(piece=this.piece, className=piece.className) {
if (!matrix.piece.holdEnabled) {
className += " disabled"
}
super.drawPiece(piece, className)
}
}
class NextQueue extends MinoesTable { class NextQueue extends MinoesTable {
constructor() { constructor() {
super("nextTable") super("nextTable")
@ -349,13 +340,11 @@ class Tetromino {
} }
matrix.drawPiece() matrix.drawPiece()
return true return true
} else if (!hardDropped) { } else if (!hardDropped && translation == TRANSLATION.DOWN) {
if (translation == TRANSLATION.DOWN) { this.locked = true
this.locked = true if (!scheduler.timeoutTasks.has(lockDown))
if (!scheduler.timeoutTasks.has(lockDown)) scheduler.setTimeout(lockDown, stats.lockDelay)
scheduler.setTimeout(lockDown, stats.lockDelay) matrix.drawPiece()
matrix.drawPiece()
}
} }
} }

View File

@ -1,3 +1,26 @@
const KEY_NAMES = new Proxy({
["ArrowLeft"] : "←",
["←"] : "ArrowLeft",
["ArrowRight"] : "→",
["→"] : "ArrowRight",
["ArrowUp"] : "↑",
["↑"] : "ArrowUp",
["ArrowDown"] : "↓",
["↓"] : "ArrowDown",
[" "] : "Espace",
["Espace"] : " ",
["Escape"] : "Échap.",
["Échap."] : "Escape",
["Backspace"] : "Ret. arrière",
["Ret. arrière"]: "Backspace",
["Enter"] : "Entrée",
["Entrée"] : "Enter",
}, {
get(target, key) {
return key in target? target[key] : key
}
})
class Settings { class Settings {
constructor() { constructor() {
this.form = settingsForm this.form = settingsForm
@ -7,20 +30,15 @@ class Settings {
} }
load() { load() {
for (let element of settingsForm.elements) { this.form.querySelectorAll("[name]").forEach(element => {
if (element.name) { if (element.name in localStorage)
if (localStorage[element.name]) element.value = localStorage[element.name] element.value = localStorage[element.name]
} })
}
window.document.selectedStyleSheetSet = stylesheetSelect.value window.document.selectedStyleSheetSet = stylesheetSelect.value
} }
save() { save() {
for (let element of settingsForm.elements) { this.form.querySelectorAll("[name]").forEach(element => localStorage[element.name] = element.value)
if (element.name) {
localStorage[element.name] = element.value
}
}
} }
init() { init() {
@ -49,7 +67,12 @@ class Settings {
this[input.name] = input.checked == true this[input.name] = input.checked == true
} }
this.keyBind = {} this.keyBind = new Proxy({}, {
get: (target, key) => target[key.toLowerCase()],
set: (target, key, value) => target[key.toLowerCase()] = value,
has: (target, key) => key.toLowerCase() in target
})
for (let actionName in playerActions) { for (let actionName in playerActions) {
this.keyBind[settings[actionName]] = playerActions[actionName] this.keyBind[settings[actionName]] = playerActions[actionName]
} }
@ -59,13 +82,29 @@ class Settings {
function changeKey(input) { function changeKey(input) {
prevValue = input.value prevValue = input.value
input.value = "" input.value = ""
keyInputs = Array.from(input.form.querySelectorAll("input[type='text']"))
input.onkeydown = function (event) { input.onkeydown = function (event) {
event.preventDefault() event.preventDefault()
input.value = KEY_NAMES[event.key] input.value = KEY_NAMES[event.key]
input.blur() keyInputs.forEach(input => {
input.setCustomValidity("")
input.classList.remove("is-invalid")
})
keyInputs.sort((input1, input2) => {
if(input1.value == input2.value) {
input1.setCustomValidity("Touche déjà utilisée")
input1.classList.add("is-invalid")
input2.setCustomValidity("Touche déjà utilisée")
input2.classList.add("is-invalid")
}
return input1.value > input2.value
})
if (input.checkValidity()) {
input.blur()
}
} }
input.onblur = function (event) { input.onblur = function (event) {
if (input.value == "") input.value = prevValue if (!input.value) input.value = prevValue
input.onkeydown = null input.onkeydown = null
input.onblur = null input.onblur = null
} }
@ -171,7 +210,7 @@ class Stats {
return new Date() - this.startTime return new Date() - this.startTime
} }
lockDown(nbClearedLines, tSpin) { lockDown(tSpin, nbClearedLines) {
this.totalClearedLines += nbClearedLines this.totalClearedLines += nbClearedLines
if (nbClearedLines == 4) this.nbQuatuors++ if (nbClearedLines == 4) this.nbQuatuors++
if (tSpin == T_SPIN.T_SPIN) this.nbTSpin++ if (tSpin == T_SPIN.T_SPIN) this.nbTSpin++

View File

@ -16,7 +16,7 @@ Copyright 2015, 2019, 2020 Google LLC. All Rights Reserved.
const OFFLINE_VERSION = 1; const OFFLINE_VERSION = 1;
const CACHE_NAME = "offline"; const CACHE_NAME = "offline";
// Customize this with a different URL if needed. // Customize this with a different URL if needed.
const OFFLINE_URL = "index.html"; const OFFLINE_URL = "../index.html";
self.addEventListener("install", (event) => { self.addEventListener("install", (event) => {
event.waitUntil( event.waitUntil(