diff --git a/frontend/src/stores/phone.ts b/frontend/src/stores/phone.ts index efd8629..edf0f86 100644 --- a/frontend/src/stores/phone.ts +++ b/frontend/src/stores/phone.ts @@ -130,6 +130,7 @@ const defaultLocales: LocaleTree = { calculator: { name: 'Calculator' }, snake: { name: 'Snake', + backToMenu: 'Back to game menu', board: 'Snake game board', controls: 'Direction controls', directions: { diff --git a/frontend/src/views/apps/SnakeApp.vue b/frontend/src/views/apps/SnakeApp.vue index b987b07..d6d3ecd 100644 --- a/frontend/src/views/apps/SnakeApp.vue +++ b/frontend/src/views/apps/SnakeApp.vue @@ -94,6 +94,11 @@ function syncGameTimer(): void { } } +function returnToMenu(): void { + stopGameTimer() + snake.showMenu() +} + function handleKeydown(event: KeyboardEvent): void { const directionByKey: Partial> = { ArrowDown: 'down', @@ -168,8 +173,42 @@ onBeforeUnmount(() => {

{{ phone.t('Apps.snake.readyTitle') }}

@@ -195,11 +234,21 @@ onBeforeUnmount(() => {
+ {{ phone.t('Apps.snake.score') }} {{ game.score }} - @@ -350,46 +399,43 @@ onBeforeUnmount(() => { .snake-mark { position: relative; - width: 118px; - height: 118px; - border: 22px solid #65c85d; - border-top-color: #84df6d; - border-radius: 50%; - filter: drop-shadow(0 14px 18px rgb(0 0 0 / 26%)); + width: 174px; + height: 148px; + display: grid; + place-items: center; + border: 1px solid rgb(180 242 164 / 9%); + border-radius: 35px; + background: + radial-gradient(circle at 75% 20%, rgb(138 226 118 / 14%), transparent 34%), + rgb(255 255 255 / 4%); + box-shadow: inset 0 1px 0 rgb(255 255 255 / 5%), 0 18px 32px rgb(0 0 0 / 19%); } -.snake-mark::after { - content: ""; - position: absolute; - right: -25px; - top: -20px; - width: 39px; - height: 29px; - border-radius: 55% 60% 55% 45%; - background: #85df6e; - transform: rotate(13deg); +.snake-mark svg { + width: 157px; + height: 134px; + overflow: visible; } -.snake-mark__eye { - position: absolute; - z-index: 2; - right: -13px; - top: -10px; - width: 5px; - height: 5px; - border-radius: 50%; - background: #142b25; +.snake-mark__body { + animation: snake-menu-breathe 2.8s ease-in-out infinite; + transform-origin: center; } .snake-mark__fruit { - position: absolute; - right: -43px; - bottom: -17px; - width: 25px; - height: 25px; - border-radius: 48% 52% 55% 45%; - background: #ff5f52; - box-shadow: inset -4px -4px 0 rgb(139 21 22 / 22%); + animation: snake-menu-fruit 1.8s ease-in-out infinite; + transform-box: fill-box; + transform-origin: center; +} + +@keyframes snake-menu-breathe { + 0%, 100% { opacity: 0.94; transform: scale(0.985); } + 50% { opacity: 1; transform: scale(1.01); } +} + +@keyframes snake-menu-fruit { + 0%, 100% { transform: translate(126px, 87px) scale(0.94); } + 50% { transform: translate(126px, 87px) scale(1.05); } } .snake-menu h1, @@ -486,13 +532,15 @@ onBeforeUnmount(() => { height: 34px; display: grid; place-items: center; - margin-left: auto; border: 1px solid rgb(255 255 255 / 9%); border-radius: 50%; color: #dff6d9; background: rgb(255 255 255 / 7%); } +.snake-game__meta .snake-game__pause { margin-left: auto; } +.snake-game__meta .snake-game__back { flex: 0 0 auto; } + .snake-board { position: relative; width: 100%; @@ -664,4 +712,9 @@ onBeforeUnmount(() => { button:active { transform: scale(0.96); } + +@media (prefers-reduced-motion: reduce) { + .snake-mark__body, + .snake-mark__fruit { animation: none; } +} diff --git a/sky_phone/config/locales/en.lua b/sky_phone/config/locales/en.lua index 35d21e5..82205c4 100644 --- a/sky_phone/config/locales/en.lua +++ b/sky_phone/config/locales/en.lua @@ -62,7 +62,8 @@ Locales["en"] = { }, calculator = { name = "Calculator" }, snake = { - name = "Snake", board = "Snake game board", controls = "Direction controls", + name = "Snake", backToMenu = "Back to game menu", board = "Snake game board", + controls = "Direction controls", directions = { down = "Move down", left = "Move left", right = "Move right", up = "Move up" }, gameOver = "Game Over", highScore = "High Score", menu = "Main Menu", pause = "Pause game", paused = "Paused", readyBody = "Collect fruit, grow longer, and stay clear of every wall.", readyTitle = "Ready to play?", diff --git a/sky_phone/source/html/index.html b/sky_phone/source/html/index.html index cb39de7..88ca1c8 100644 --- a/sky_phone/source/html/index.html +++ b/sky_phone/source/html/index.html @@ -4,7 +4,7 @@ Sky Phone - +