Skip to content

Commit

Permalink
Add a 4th animation that rotates colours
Browse files Browse the repository at this point in the history
Unlike the others, this animation doesn't reset when you go to a new maze.

So it becomes an easter egg way to change the game colour.

Whether it affects dialogs seems to be browser dependent.
  • Loading branch information
ccouzens committed Apr 20, 2024
1 parent 9fe5d3c commit a61a6a4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions public/game-win-animations.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,23 @@
stroke-width: 1;
}
}

:root {
animation: 10s infinite normal hue-rotate;
animation-timing-function: linear;
animation-play-state: paused;
}

:root.win[data-animation="4"] {
animation-play-state: running;
}

@keyframes hue-rotate {
from {
filter: hue-rotate(0);
}

to {
filter: hue-rotate(360deg);
}
}
2 changes: 1 addition & 1 deletion src/game/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function newMaze(app: App): void {
"viewBox",
`-0.125 -0.125 ${app.computer.maze_width(app.maze) + 0.25} ${app.computer.maze_height(app.maze) + 0.25}`,
);
app.root.dataset["animation"] = `${Math.floor(Math.random() * 3) + 1}`;
app.root.dataset["animation"] = `${Math.floor(Math.random() * 4) + 1}`;
renderAfterMove(app);
}

Expand Down

0 comments on commit a61a6a4

Please sign in to comment.