locked animation

This commit is contained in:
Adrien MALINGREY 2023-06-16 00:06:49 +02:00
parent 70d8e6e0aa
commit d615b6b72b
2 changed files with 18 additions and 5 deletions

10
app.js
View File

@ -177,8 +177,8 @@ class NextQueue extends MinoesTable {
init() { init() {
this.pieces = this.init_centers.map(center => { this.pieces = this.init_centers.map(center => {
let piece = new Tetromino.pick() let piece = new Tetromino.pick()
piece.center = Array.from(center) piece.center = Array.from(center)
return piece return piece
}) })
} }
@ -222,9 +222,9 @@ class Matrix extends MinoesTable {
return this._piece return this._piece
} }
set piece(piece) { set piece(piece) {
this._piece = piece this._piece = piece
this._piece.center = Array.from(this.init_center) this._piece.center = Array.from(this.init_center)
this.ghost = piece.ghost this.ghost = piece.ghost
this.redraw() this.redraw()
this.drawPiece() this.drawPiece()
} }
@ -244,7 +244,7 @@ class Matrix extends MinoesTable {
for (let y=0; y<this.rows; y++) { for (let y=0; y<this.rows; y++) {
for (let x=0; x<this.columns; x++) { for (let x=0; x<this.columns; x++) {
if (this.table.rows[y].cells[x].classList != "trail-animation") if (this.table.rows[y].cells[x].classList != "trail-animation")
this.drawMino([x, y], this.blocks[y][x] || "") this.drawMino([x, y], "locked " + this.blocks[y][x] || "")
} }
} }
} }

View File

@ -57,3 +57,16 @@ body {
1px -1px 4px rgba(186, 211, 255, 27%), 1px -1px 4px rgba(186, 211, 255, 27%),
1px 1px 4px rgba(186, 211, 255, 27%); 1px 1px 4px rgba(186, 211, 255, 27%);
} }
@keyframes locked-animation {
from {
opacity: 1;
background: white;
border-color: white;
}
}
.locked.mino {
animation: locked-animation;
animation-duration: 0.2s;
}