mirror of
https://github.com/rommapp/romm.git
synced 2026-11-30 02:22:44 +01:00
Merge pull request #3552 from rommapp/feat/crt-mode
feat: CRT mode as a theme setting
This commit is contained in:
@@ -15,6 +15,7 @@ import { fileURLToPath } from "node:url";
|
||||
import {
|
||||
colorBrand,
|
||||
colorCanvas,
|
||||
colorCrt,
|
||||
colorDark,
|
||||
colorLight,
|
||||
colorOverlay,
|
||||
@@ -143,6 +144,7 @@ const SHARED: Entry[] = [
|
||||
...entriesFor(colorProvider, "colorProvider", "--r-color-provider"),
|
||||
...entriesFor(colorOverlay, "colorOverlay", "--r-color-overlay"),
|
||||
...entriesFor(colorCanvas, "colorCanvas", "--r-color-canvas"),
|
||||
...entriesFor(colorCrt, "colorCrt", "--r-color-crt"),
|
||||
...entriesFor(fontFamily, "fontFamily", "--r-font-family"),
|
||||
...entriesFor(fontSize, "fontSize", "--r-font-size"),
|
||||
...entriesFor(lineHeight, "lineHeight", "--r-line-height"),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"crt-mode": "CRT mode",
|
||||
"about": "Относно",
|
||||
"add": "Добави",
|
||||
"administration": "Администрация",
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
"couldnt-fetch-missing-roms": "Неуспешно зареждане на липсващи ROM-ове: {error}",
|
||||
"deferred": "Отложено",
|
||||
"deleting-mapping": "Изтриване",
|
||||
"crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker",
|
||||
"disable-animations": "Изключи анимациите",
|
||||
"disable-animations-desc": "Изключи всички анимации в галерията (въртящ се CD, зареждане на касета, видео при посочване)",
|
||||
"edit-user": "Редактирай потребител",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"crt-mode": "CRT mode",
|
||||
"about": "O aplikaci",
|
||||
"add": "Přidat",
|
||||
"administration": "Administrace",
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
"couldnt-fetch-missing-roms": "Nelze načíst chybějící ROM: {error}",
|
||||
"deferred": "Odloženo",
|
||||
"deleting-mapping": "Mazání",
|
||||
"crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker",
|
||||
"disable-animations": "Zakázat animace",
|
||||
"disable-animations-desc": "Zakáže všechny animace v galerii (otáčení CD, vkládání cartridge, hover videa)",
|
||||
"edit-user": "Upravit uživatele",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"crt-mode": "CRT-Modus",
|
||||
"about": "Über",
|
||||
"add": "Hinzufügen",
|
||||
"administration": "Administration",
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
"couldnt-fetch-missing-roms": "Fehlende ROMs konnten nicht abgerufen werden: {error}",
|
||||
"deferred": "Aufgeschoben",
|
||||
"deleting-mapping": "Löschen",
|
||||
"crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker",
|
||||
"disable-animations": "Animationen deaktivieren",
|
||||
"disable-animations-desc": "Alle Animationen in der Galerie deaktivieren (CD-Rotation, Kassettenladen, Hover-Videos)",
|
||||
"edit-user": "Benutzer bearbeiten",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"crt-mode": "CRT mode",
|
||||
"about": "About",
|
||||
"add": "Add",
|
||||
"administration": "Administration",
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
"couldnt-fetch-missing-roms": "Couldn't fetch missing ROMs: {error}",
|
||||
"deferred": "Deferred",
|
||||
"deleting-mapping": "Deleting",
|
||||
"crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker",
|
||||
"disable-animations": "Disable animations",
|
||||
"disable-animations-desc": "Disable all animations in the gallery (CD spinning, cartridge loading, hover videos)",
|
||||
"edit-user": "Edit user",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"crt-mode": "CRT mode",
|
||||
"about": "About",
|
||||
"add": "Add",
|
||||
"administration": "Administration",
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
"couldnt-fetch-missing-roms": "Couldn't fetch missing ROMs: {error}",
|
||||
"deferred": "Deferred",
|
||||
"deleting-mapping": "Deleting",
|
||||
"crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker",
|
||||
"disable-animations": "Disable animations",
|
||||
"disable-animations-desc": "Disable all animations in the gallery (CD spinning, cartridge loading, hover videos)",
|
||||
"edit-user": "Edit user",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"crt-mode": "Modo CRT",
|
||||
"about": "Acerca de",
|
||||
"add": "Añadir",
|
||||
"administration": "Administración",
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
"couldnt-fetch-missing-roms": "No se pudieron obtener las ROM faltantes: {error}",
|
||||
"deferred": "Diferido",
|
||||
"deleting-mapping": "Eliminando",
|
||||
"crt-mode-desc": "Dale a la interfaz un aspecto retro de tubo de rayos catódicos con líneas de escaneo, brillo y parpadeo",
|
||||
"disable-animations": "Desactivar animaciones",
|
||||
"disable-animations-desc": "Desactivar todas las animaciones en la galería (rotación de CD, carga de cartuchos, videos al pasar el ratón)",
|
||||
"edit-user": "Editar usuario",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"crt-mode": "Mode CRT",
|
||||
"about": "À propos",
|
||||
"add": "Ajouter",
|
||||
"administration": "Administration",
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
"couldnt-fetch-missing-roms": "Impossible de récupérer les ROM manquantes : {error}",
|
||||
"deferred": "Différé",
|
||||
"deleting-mapping": "Suppression",
|
||||
"crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker",
|
||||
"disable-animations": "Désactiver les animations",
|
||||
"disable-animations-desc": "Désactiver toutes les animations dans la galerie (rotation de CD, chargement de cartouche, vidéos au survol)",
|
||||
"edit-user": "Modifier l'utilisateur",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"crt-mode": "CRT mode",
|
||||
"about": "Rólunk",
|
||||
"add": "Hozzáadás",
|
||||
"administration": "Adminisztráció",
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
"couldnt-fetch-missing-roms": "A hiányzó ROM-ok lekérése sikertelen: {error}",
|
||||
"deferred": "Hivatkozás megszüntetve",
|
||||
"deleting-mapping": "Törlés",
|
||||
"crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker",
|
||||
"disable-animations": "Animációk letiltása",
|
||||
"disable-animations-desc": "Kapcsolja ki az összes animációt a galériában (CD forgatás, kazetta betöltés, lebegő videók)",
|
||||
"edit-user": "Felhasználó szerkesztése",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"crt-mode": "Modalità CRT",
|
||||
"about": "Informazioni",
|
||||
"add": "Aggiungi",
|
||||
"administration": "Amministrazione",
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
"couldnt-fetch-missing-roms": "Impossibile recuperare le ROM mancanti: {error}",
|
||||
"deferred": "Rimandato",
|
||||
"deleting-mapping": "Eliminazione",
|
||||
"crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker",
|
||||
"disable-animations": "Disabilita animazioni",
|
||||
"disable-animations-desc": "Disabilita tutte le animazioni nella galleria (rotazione CD, caricamento cartucce, video al passaggio del mouse)",
|
||||
"edit-user": "Modifica utente",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"crt-mode": "CRT mode",
|
||||
"about": "概要",
|
||||
"add": "追加",
|
||||
"administration": "管理者メニュー",
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
"couldnt-fetch-missing-roms": "不足しているROMを取得できませんでした: {error}",
|
||||
"deferred": "延期済み",
|
||||
"deleting-mapping": "削除中",
|
||||
"crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker",
|
||||
"disable-animations": "アニメーションを無効化",
|
||||
"disable-animations-desc": "ギャラリー内のすべてのアニメーションを無効化(CD回転、カートリッジ読み込み、ホバービデオ)",
|
||||
"edit-user": "ユーザーを編集",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"crt-mode": "CRT mode",
|
||||
"about": "정보",
|
||||
"add": "추가",
|
||||
"administration": "유저 관리",
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
"couldnt-fetch-missing-roms": "누락된 ROM을 가져오지 못했습니다: {error}",
|
||||
"deferred": "연기됨",
|
||||
"deleting-mapping": "삭제 중",
|
||||
"crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker",
|
||||
"disable-animations": "애니메이션 비활성화",
|
||||
"disable-animations-desc": "갤러리의 모든 애니메이션 비활성화 (CD 회전, 카트리지 로딩, 호버 비디오)",
|
||||
"edit-user": "사용자 편집",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"crt-mode": "CRT mode",
|
||||
"about": "O aplikacji",
|
||||
"add": "Dodaj",
|
||||
"administration": "Administracja",
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
"couldnt-fetch-missing-roms": "Nie udało się pobrać brakujących ROM-ów: {error}",
|
||||
"deferred": "Odroczono",
|
||||
"deleting-mapping": "Usuwanie",
|
||||
"crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker",
|
||||
"disable-animations": "Wyłącz animacje",
|
||||
"disable-animations-desc": "Wyłącz wszystkie animacje w galerii (obracanie CD, ładowanie kartridży, wideo po najechaniu)",
|
||||
"edit-user": "Edytuj użytkownika",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"crt-mode": "Modo CRT",
|
||||
"about": "Sobre",
|
||||
"add": "Adicionar",
|
||||
"administration": "Administração",
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
"couldnt-fetch-missing-roms": "Não foi possível obter as ROMs ausentes: {error}",
|
||||
"deferred": "Adiado",
|
||||
"deleting-mapping": "Excluindo",
|
||||
"crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker",
|
||||
"disable-animations": "Desativar animações",
|
||||
"disable-animations-desc": "Desativar todas as animações na galeria (rotação de CD, carregamento de cartuchos, vídeos ao passar o mouse)",
|
||||
"edit-user": "Editar usuário",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"crt-mode": "CRT mode",
|
||||
"about": "Despre",
|
||||
"add": "Adaugă",
|
||||
"administration": "Administrare",
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
"couldnt-fetch-missing-roms": "Nu s-au putut prelua ROM-urile lipsă: {error}",
|
||||
"deferred": "Amânat",
|
||||
"deleting-mapping": "Ștergere",
|
||||
"crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker",
|
||||
"disable-animations": "Dezactivează animațiile",
|
||||
"disable-animations-desc": "Dezactivează toate animațiile din galerie (rotirea CD-ului, încărcarea cartușului, videoclipurile la trecerea mouse-ului)",
|
||||
"edit-user": "Editează utilizatorul",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"crt-mode": "CRT mode",
|
||||
"about": "О приложении",
|
||||
"add": "Добавить",
|
||||
"administration": "Администрирование",
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
"couldnt-fetch-missing-roms": "Не удалось получить отсутствующие ROM: {error}",
|
||||
"deferred": "Отложено",
|
||||
"deleting-mapping": "Удаление",
|
||||
"crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker",
|
||||
"disable-animations": "Отключить анимации",
|
||||
"disable-animations-desc": "Отключить все анимации в галерее (вращение CD, загрузка картриджей, видео при наведении)",
|
||||
"edit-user": "Редактировать пользователя",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"crt-mode": "CRT mode",
|
||||
"about": "关于",
|
||||
"add": "添加",
|
||||
"administration": "管理",
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
"couldnt-fetch-missing-roms": "无法获取缺失的 ROM:{error}",
|
||||
"deferred": "已延期",
|
||||
"deleting-mapping": "删除中",
|
||||
"crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker",
|
||||
"disable-animations": "禁用动画",
|
||||
"disable-animations-desc": "禁用游戏库中的所有动画(CD 旋转、卡带加载、悬停视频)",
|
||||
"edit-user": "编辑用户",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"crt-mode": "CRT mode",
|
||||
"about": "關於",
|
||||
"add": "新增",
|
||||
"administration": "管理系統",
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
"couldnt-fetch-missing-roms": "無法取得缺少的 ROM:{error}",
|
||||
"deferred": "已延期",
|
||||
"deleting-mapping": "刪除中",
|
||||
"crt-mode-desc": "Give the interface a retro cathode-ray-tube look with scanlines, glow and flicker",
|
||||
"disable-animations": "停用動畫",
|
||||
"disable-animations-desc": "停用遊戲庫中的所有動畫(CD 旋轉、卡帶載入、懸停影片)",
|
||||
"edit-user": "編輯用戶",
|
||||
|
||||
169
frontend/src/v2/components/AppShell/CrtOverlay.vue
Normal file
169
frontend/src/v2/components/AppShell/CrtOverlay.vue
Normal file
@@ -0,0 +1,169 @@
|
||||
<script setup lang="ts">
|
||||
// CrtOverlay — the persistent "CRT mode" shader. While CRT mode is on this
|
||||
// sits above the whole app (teleported to <body> so it also covers
|
||||
// teleported dialogs/menus), pointer-events:none so it never traps input,
|
||||
// and layers scanlines + a rolling refresh band + vignette/curvature +
|
||||
// flicker + an occasional chromatic-aberration glitch to sell the cathode-
|
||||
// ray-tube look — without ever distorting the real DOM (it stays readable).
|
||||
//
|
||||
// Chrome-only: no stores/services/domain text. Self-gates on useCrtMode.
|
||||
// The one-shot power-on flash is a separate component (CrtWarmup.vue).
|
||||
import { useCrtMode } from "@/v2/composables/useCrtMode";
|
||||
|
||||
const { enabled } = useCrtMode();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<div v-if="enabled" class="r-crtfx" aria-hidden="true">
|
||||
<div class="r-crtfx__scan"></div>
|
||||
<div class="r-crtfx__roll"></div>
|
||||
<div class="r-crtfx__glitch"></div>
|
||||
<div class="r-crtfx__vignette"></div>
|
||||
</div>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.r-crtfx {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 99990;
|
||||
pointer-events: none;
|
||||
overflow: hidden;
|
||||
/* Phosphor "punch" — grade the live app behind the overlay (saturation +
|
||||
contrast). Done via backdrop-filter rather than a CSS `filter` on a
|
||||
layout container: this layer is teleported to <body>, a sibling of the
|
||||
app root, so it never becomes a containing block for the app's own
|
||||
position:fixed chrome (navbar, gallery SelectionBar, …). */
|
||||
backdrop-filter: saturate(1.3) contrast(1.05) brightness(1.02);
|
||||
-webkit-backdrop-filter: saturate(1.3) contrast(1.05) brightness(1.02);
|
||||
/* Subtle whole-screen flicker — the CRT never sits perfectly still. */
|
||||
animation: r-crtfx-flicker 0.14s steps(2, end) infinite;
|
||||
}
|
||||
|
||||
.r-crtfx__scan,
|
||||
.r-crtfx__roll,
|
||||
.r-crtfx__glitch,
|
||||
.r-crtfx__vignette {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
}
|
||||
|
||||
/* Horizontal scanlines, drifting slowly upward so the grille feels alive. */
|
||||
.r-crtfx__scan {
|
||||
background: repeating-linear-gradient(
|
||||
to bottom,
|
||||
color-mix(in srgb, black 34%, transparent) 0,
|
||||
color-mix(in srgb, black 34%, transparent) 1px,
|
||||
transparent 1px,
|
||||
transparent 3px
|
||||
);
|
||||
animation: r-crtfx-scan-roll 8s linear infinite;
|
||||
}
|
||||
|
||||
/* Bright "vertical retrace" band sweeping down the screen. */
|
||||
.r-crtfx__roll {
|
||||
background: linear-gradient(
|
||||
to bottom,
|
||||
transparent 0%,
|
||||
color-mix(in srgb, white 7%, transparent) 46%,
|
||||
color-mix(in srgb, var(--r-color-crt-glow) 9%, transparent) 50%,
|
||||
transparent 54%,
|
||||
transparent 100%
|
||||
);
|
||||
animation: r-crtfx-roll 7s linear infinite;
|
||||
}
|
||||
|
||||
/* Chromatic-aberration ghost slices — idle most of the time, then jolt.
|
||||
Two stacked box-shadows give a red/cyan RGB-split fringe; the keyframes
|
||||
nudge the layer sideways in quick steps for the "tracking error" glitch. */
|
||||
.r-crtfx__glitch {
|
||||
box-shadow:
|
||||
inset 2px 0 0
|
||||
color-mix(in srgb, var(--r-color-crt-ghost-warm) 22%, transparent),
|
||||
inset -2px 0 0
|
||||
color-mix(in srgb, var(--r-color-crt-ghost-cool) 22%, transparent);
|
||||
opacity: 0;
|
||||
animation: r-crtfx-glitch 6.5s steps(1, end) infinite;
|
||||
}
|
||||
|
||||
/* Rounded-tube vignette + a faint inner curvature highlight. */
|
||||
.r-crtfx__vignette {
|
||||
background: radial-gradient(
|
||||
ellipse at center,
|
||||
transparent 55%,
|
||||
color-mix(in srgb, black 55%, transparent) 100%
|
||||
);
|
||||
box-shadow:
|
||||
inset 0 0 120px color-mix(in srgb, black 45%, transparent),
|
||||
inset 0 0 30px color-mix(in srgb, var(--r-color-crt-glow) 6%, transparent);
|
||||
}
|
||||
|
||||
@keyframes r-crtfx-flicker {
|
||||
0% {
|
||||
opacity: 0.94;
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes r-crtfx-scan-roll {
|
||||
0% {
|
||||
background-position-y: 0;
|
||||
}
|
||||
100% {
|
||||
background-position-y: -120px;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes r-crtfx-roll {
|
||||
0% {
|
||||
transform: translateY(-100%);
|
||||
}
|
||||
100% {
|
||||
transform: translateY(100%);
|
||||
}
|
||||
}
|
||||
|
||||
/* Mostly invisible; brief chromatic jolts at a few points in the loop. */
|
||||
@keyframes r-crtfx-glitch {
|
||||
0%,
|
||||
11.5%,
|
||||
12.5%,
|
||||
46%,
|
||||
47.2%,
|
||||
72%,
|
||||
72.8%,
|
||||
100% {
|
||||
opacity: 0;
|
||||
transform: translateX(0);
|
||||
}
|
||||
12% {
|
||||
opacity: 0.9;
|
||||
transform: translateX(-3px);
|
||||
}
|
||||
46.6% {
|
||||
opacity: 0.7;
|
||||
transform: translateX(2px);
|
||||
}
|
||||
72.4% {
|
||||
opacity: 0.85;
|
||||
transform: translateX(-2px);
|
||||
}
|
||||
}
|
||||
|
||||
/* Reduced motion: keep the static CRT texture (scanlines + vignette) but
|
||||
drop every moving / flickering layer. */
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.r-crtfx,
|
||||
.r-crtfx__scan {
|
||||
animation: none;
|
||||
}
|
||||
.r-crtfx__roll,
|
||||
.r-crtfx__glitch {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
329
frontend/src/v2/components/AppShell/CrtWarmup.vue
Normal file
329
frontend/src/v2/components/AppShell/CrtWarmup.vue
Normal file
@@ -0,0 +1,329 @@
|
||||
<script setup lang="ts">
|
||||
// CrtWarmup — a purely cosmetic "CRT phosphor warm-up" easter egg, fired when
|
||||
// CRT mode is switched ON (see useCrtMode / Settings → User Interface → Theme). Plays a fast, glitchy,
|
||||
// old-television power-on flash: instant black-out, a bright collapsing
|
||||
// scanline, a phosphor bloom with chromatic-aberration tearing, a sync-roll
|
||||
// band and jittering scanlines, then a quick settle back to the live app.
|
||||
//
|
||||
// Chrome-only — no stores/services/domain, no user-visible text (so it stays
|
||||
// trivially theme-agnostic). Teleported to <body> so it covers teleported
|
||||
// overlays too, and rendered pointer-events:none so it never traps input.
|
||||
// Auto-removes when the master timeline ends. Honours prefers-reduced-motion
|
||||
// (a brief motion-free fade).
|
||||
import { nextTick, ref } from "vue";
|
||||
|
||||
const visible = ref(false);
|
||||
// Bumping the key remounts the layer so the CSS animations restart from
|
||||
// frame 0 — lets the user re-trigger the gimmick mid-flash.
|
||||
const runId = ref(0);
|
||||
|
||||
async function play() {
|
||||
visible.value = false;
|
||||
await nextTick();
|
||||
runId.value += 1;
|
||||
visible.value = true;
|
||||
}
|
||||
|
||||
// `.self` so only the container's own master animation ends the run — child
|
||||
// layer animations bubble their animationend but must not cut the timeline
|
||||
// short. The master animation is the longest, so it fires last.
|
||||
function onEnded() {
|
||||
visible.value = false;
|
||||
}
|
||||
|
||||
defineExpose({ play });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<div
|
||||
v-if="visible"
|
||||
:key="runId"
|
||||
class="r-crt"
|
||||
aria-hidden="true"
|
||||
@animationend.self="onEnded"
|
||||
>
|
||||
<div class="r-crt__bloom"></div>
|
||||
<div class="r-crt__line"></div>
|
||||
<div class="r-crt__glitch"></div>
|
||||
<div class="r-crt__roll"></div>
|
||||
<div class="r-crt__scan"></div>
|
||||
<div class="r-crt__vignette"></div>
|
||||
</div>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.r-crt {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 99999;
|
||||
pointer-events: none;
|
||||
overflow: hidden;
|
||||
background-color: var(--r-color-canvas-bg);
|
||||
animation: r-crt-master 1.05s linear both;
|
||||
}
|
||||
|
||||
/* Each decorative layer shares the master duration so they all settle on the
|
||||
same frame; their keyframes place the action along the shared timeline. */
|
||||
.r-crt__bloom,
|
||||
.r-crt__line,
|
||||
.r-crt__glitch,
|
||||
.r-crt__roll,
|
||||
.r-crt__scan,
|
||||
.r-crt__vignette {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
animation-duration: 1.05s;
|
||||
animation-fill-mode: both;
|
||||
}
|
||||
|
||||
/* White-hot core fading out to phosphor green — the main "flash". */
|
||||
.r-crt__bloom {
|
||||
background: radial-gradient(
|
||||
ellipse at center,
|
||||
white 0%,
|
||||
color-mix(in srgb, var(--r-color-crt-glow) 85%, white) 16%,
|
||||
color-mix(in srgb, var(--r-color-crt-glow) 65%, transparent) 44%,
|
||||
transparent 72%
|
||||
);
|
||||
animation-name: r-crt-bloom;
|
||||
animation-timing-function: ease-out;
|
||||
}
|
||||
|
||||
/* The iconic collapsing scanline that snaps in before the bloom blooms. */
|
||||
.r-crt__line {
|
||||
top: 50%;
|
||||
bottom: auto;
|
||||
height: 3px;
|
||||
background: white;
|
||||
box-shadow:
|
||||
0 0 12px 4px white,
|
||||
0 0 40px 12px var(--r-color-crt-glow);
|
||||
transform: translateY(-50%) scaleY(1);
|
||||
animation-name: r-crt-line;
|
||||
animation-timing-function: ease-in;
|
||||
}
|
||||
|
||||
/* Chromatic-aberration tearing — red/cyan RGB-split fringes that jump
|
||||
sideways in hard steps while the tube "locks on". */
|
||||
.r-crt__glitch {
|
||||
box-shadow:
|
||||
inset 5px 0 0
|
||||
color-mix(in srgb, var(--r-color-crt-ghost-warm) 55%, transparent),
|
||||
inset -5px 0 0
|
||||
color-mix(in srgb, var(--r-color-crt-ghost-cool) 55%, transparent);
|
||||
opacity: 0;
|
||||
animation-name: r-crt-glitch;
|
||||
animation-timing-function: steps(1, end);
|
||||
}
|
||||
|
||||
/* Bright vertical-hold "roll" band sweeping down before the picture settles. */
|
||||
.r-crt__roll {
|
||||
background: linear-gradient(
|
||||
to bottom,
|
||||
transparent 0%,
|
||||
color-mix(in srgb, white 22%, transparent) 48%,
|
||||
color-mix(in srgb, var(--r-color-crt-glow) 20%, transparent) 52%,
|
||||
transparent 56%,
|
||||
transparent 100%
|
||||
);
|
||||
animation-name: r-crt-roll;
|
||||
animation-timing-function: linear;
|
||||
}
|
||||
|
||||
.r-crt__scan {
|
||||
background: repeating-linear-gradient(
|
||||
to bottom,
|
||||
color-mix(in srgb, black 46%, transparent) 0,
|
||||
color-mix(in srgb, black 46%, transparent) 1px,
|
||||
transparent 1px,
|
||||
transparent 3px
|
||||
);
|
||||
animation-name: r-crt-scan;
|
||||
animation-timing-function: linear;
|
||||
}
|
||||
|
||||
.r-crt__vignette {
|
||||
background: radial-gradient(
|
||||
ellipse at center,
|
||||
transparent 52%,
|
||||
color-mix(in srgb, black 70%, transparent) 100%
|
||||
);
|
||||
animation-name: r-crt-vignette;
|
||||
animation-timing-function: ease-out;
|
||||
}
|
||||
|
||||
@keyframes r-crt-master {
|
||||
0% {
|
||||
background-color: transparent;
|
||||
}
|
||||
4% {
|
||||
background-color: var(--r-color-canvas-bg);
|
||||
}
|
||||
74% {
|
||||
background-color: var(--r-color-canvas-bg);
|
||||
}
|
||||
100% {
|
||||
background-color: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes r-crt-line {
|
||||
0% {
|
||||
opacity: 0;
|
||||
transform: translateY(-50%) scaleY(0.3);
|
||||
}
|
||||
5% {
|
||||
opacity: 1;
|
||||
transform: translateY(-50%) scaleY(1);
|
||||
}
|
||||
16% {
|
||||
opacity: 1;
|
||||
transform: translateY(-50%) scaleY(1);
|
||||
}
|
||||
30% {
|
||||
opacity: 0.9;
|
||||
transform: translateY(-50%) scaleY(280);
|
||||
}
|
||||
40% {
|
||||
opacity: 0;
|
||||
transform: translateY(-50%) scaleY(340);
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes r-crt-bloom {
|
||||
0%,
|
||||
13% {
|
||||
opacity: 0;
|
||||
transform: scale(0.7);
|
||||
}
|
||||
26% {
|
||||
opacity: 1;
|
||||
transform: scale(1.05);
|
||||
}
|
||||
46% {
|
||||
opacity: 0.4;
|
||||
transform: scale(1);
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Hard-stepped chromatic tearing concentrated in the lock-on phase. */
|
||||
@keyframes r-crt-glitch {
|
||||
0%,
|
||||
17%,
|
||||
20%,
|
||||
29%,
|
||||
35%,
|
||||
55%,
|
||||
100% {
|
||||
opacity: 0;
|
||||
transform: translateX(0);
|
||||
}
|
||||
18% {
|
||||
opacity: 1;
|
||||
transform: translateX(-8px);
|
||||
}
|
||||
24% {
|
||||
opacity: 1;
|
||||
transform: translateX(7px);
|
||||
}
|
||||
31% {
|
||||
opacity: 0.9;
|
||||
transform: translateX(-5px);
|
||||
}
|
||||
44% {
|
||||
opacity: 0.7;
|
||||
transform: translateX(4px);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes r-crt-roll {
|
||||
0%,
|
||||
18% {
|
||||
transform: translateY(-120%);
|
||||
opacity: 0;
|
||||
}
|
||||
20% {
|
||||
opacity: 1;
|
||||
}
|
||||
70% {
|
||||
opacity: 1;
|
||||
}
|
||||
82%,
|
||||
100% {
|
||||
transform: translateY(120%);
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes r-crt-scan {
|
||||
0%,
|
||||
20% {
|
||||
opacity: 0;
|
||||
}
|
||||
34% {
|
||||
opacity: 0.6;
|
||||
}
|
||||
80% {
|
||||
opacity: 0.25;
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes r-crt-vignette {
|
||||
0%,
|
||||
14% {
|
||||
opacity: 0;
|
||||
}
|
||||
36% {
|
||||
opacity: 1;
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Reduced motion: drop the busy sweeping / tearing layers, keep a brief
|
||||
phosphor-tinted fade so the easter egg still acknowledges the toggle. */
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.r-crt {
|
||||
animation: r-crt-reduced 0.45s ease-out both;
|
||||
}
|
||||
.r-crt__line,
|
||||
.r-crt__glitch,
|
||||
.r-crt__roll,
|
||||
.r-crt__scan,
|
||||
.r-crt__vignette {
|
||||
display: none;
|
||||
}
|
||||
.r-crt__bloom {
|
||||
animation: r-crt-reduced-bloom 0.45s ease-out both;
|
||||
}
|
||||
@keyframes r-crt-reduced {
|
||||
0% {
|
||||
background-color: var(--r-color-canvas-bg);
|
||||
}
|
||||
100% {
|
||||
background-color: transparent;
|
||||
}
|
||||
}
|
||||
@keyframes r-crt-reduced-bloom {
|
||||
0% {
|
||||
opacity: 0.6;
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
68
frontend/src/v2/composables/useCrtMode/index.test.ts
Normal file
68
frontend/src/v2/composables/useCrtMode/index.test.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { nextTick } from "vue";
|
||||
|
||||
const KEY = "settings.v2.crtMode";
|
||||
|
||||
// `enabled` is a module-level singleton created at import time, so it reads
|
||||
// localStorage exactly once on load. Re-import the module fresh after seeding
|
||||
// storage to exercise the default / persisted-read paths in isolation.
|
||||
async function loadFresh() {
|
||||
vi.resetModules();
|
||||
const { useCrtMode } = await import("./index");
|
||||
return useCrtMode();
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
localStorage.clear();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
localStorage.clear();
|
||||
});
|
||||
|
||||
describe("useCrtMode", () => {
|
||||
it("defaults to off when nothing is persisted", async () => {
|
||||
const { enabled } = await loadFresh();
|
||||
expect(enabled.value).toBe(false);
|
||||
});
|
||||
|
||||
it("restores a previously persisted value on load", async () => {
|
||||
localStorage.setItem(KEY, "true");
|
||||
const { enabled } = await loadFresh();
|
||||
expect(enabled.value).toBe(true);
|
||||
});
|
||||
|
||||
it("persists changes under the 'settings.v2.crtMode' key", async () => {
|
||||
const { enabled } = await loadFresh();
|
||||
enabled.value = true;
|
||||
await nextTick();
|
||||
expect(localStorage.getItem(KEY)).toBe("true");
|
||||
});
|
||||
|
||||
it("toggle() flips the state and returns the new value", async () => {
|
||||
const { enabled, toggle } = await loadFresh();
|
||||
expect(enabled.value).toBe(false);
|
||||
|
||||
expect(toggle()).toBe(true);
|
||||
expect(enabled.value).toBe(true);
|
||||
|
||||
expect(toggle()).toBe(false);
|
||||
expect(enabled.value).toBe(false);
|
||||
});
|
||||
|
||||
it("toggle() writes through to localStorage", async () => {
|
||||
const { toggle } = await loadFresh();
|
||||
toggle();
|
||||
await nextTick();
|
||||
expect(localStorage.getItem(KEY)).toBe("true");
|
||||
});
|
||||
|
||||
it("shares a single instance across calls within a load", async () => {
|
||||
vi.resetModules();
|
||||
const { useCrtMode } = await import("./index");
|
||||
const a = useCrtMode();
|
||||
const b = useCrtMode();
|
||||
a.toggle();
|
||||
expect(b.enabled.value).toBe(true);
|
||||
});
|
||||
});
|
||||
25
frontend/src/v2/composables/useCrtMode/index.ts
Normal file
25
frontend/src/v2/composables/useCrtMode/index.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
// useCrtMode — singleton toggle for the cosmetic "CRT mode" shader.
|
||||
//
|
||||
// CRT mode is a purely visual easter egg: when on, a persistent full-screen
|
||||
// scanline / vignette / flicker / glitch overlay (CrtOverlay.vue) makes RomM
|
||||
// look like it is running on an old cathode-ray tube, and toggling it ON
|
||||
// fires the one-shot power-on warm-up flash (CrtWarmup.vue).
|
||||
//
|
||||
// State is persisted in localStorage and shared across components through a
|
||||
// single module-level ref — same rationale as `useUiVersion`: vueuse's
|
||||
// useLocalStorage creates an independent ref per call (shared storage, not
|
||||
// shared reactivity within a tab), so we create it once here and everyone
|
||||
// imports the same instance.
|
||||
import { useLocalStorage } from "@vueuse/core";
|
||||
|
||||
const enabled = useLocalStorage("settings.v2.crtMode", false);
|
||||
|
||||
export function useCrtMode() {
|
||||
/** Flip CRT mode and return the new state (true = now on). */
|
||||
function toggle(): boolean {
|
||||
enabled.value = !enabled.value;
|
||||
return enabled.value;
|
||||
}
|
||||
|
||||
return { enabled, toggle };
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import AppNav from "@/v2/components/AppShell/AppNav.vue";
|
||||
import BackgroundArt from "@/v2/components/AppShell/BackgroundArt.vue";
|
||||
import BottomNav from "@/v2/components/AppShell/BottomNav.vue";
|
||||
import BreakpointBadge from "@/v2/components/AppShell/BreakpointBadge.vue";
|
||||
import CrtOverlay from "@/v2/components/AppShell/CrtOverlay.vue";
|
||||
import GlobalDialogs from "@/v2/components/Dialogs/GlobalDialogs.vue";
|
||||
import SoundtrackMiniPlayer from "@/v2/components/Soundtrack/MiniPlayer.vue";
|
||||
import { BACKGROUND_ART_KEY } from "@/v2/composables/useBackgroundArt";
|
||||
@@ -143,6 +144,7 @@ onBeforeUnmount(() => {
|
||||
<GlobalDialogs />
|
||||
<SoundtrackMiniPlayer />
|
||||
<BreakpointBadge />
|
||||
<CrtOverlay />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -62,6 +62,9 @@
|
||||
--r-color-overlay-emphasis-fg: #111117;
|
||||
--r-color-canvas-bg: #000000;
|
||||
--r-color-canvas-bg-deep: #0d1117;
|
||||
--r-color-crt-glow: #7dffb4;
|
||||
--r-color-crt-ghost-warm: #ff3b5c;
|
||||
--r-color-crt-ghost-cool: #3bd9ff;
|
||||
--r-font-family-sans:
|
||||
"Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, "Inter", Roboto,
|
||||
sans-serif;
|
||||
|
||||
@@ -173,6 +173,20 @@ export const colorCanvas = {
|
||||
bgDeep: "#0d1117",
|
||||
} as const;
|
||||
|
||||
// CRT gimmick — the cosmetic "CRT mode" shader + power-on warm-up flash
|
||||
// (see CrtOverlay.vue / CrtWarmup.vue, toggled from Settings → User Interface → Theme).
|
||||
// Theme-agnostic by design: the phosphor green and the red/cyan chromatic-aberration ghosts
|
||||
// read the same on dark and light, so they live in SHARED rather than the
|
||||
// per-theme palettes. Consumed only as CSS vars (--r-color-crt-*), always at
|
||||
// low opacity via color-mix.
|
||||
export const colorCrt = {
|
||||
// Phosphor afterglow / glow tint (P1 green).
|
||||
glow: "#7dffb4",
|
||||
// Chromatic-aberration ghosts for the RGB-split glitch.
|
||||
ghostWarm: "#ff3b5c",
|
||||
ghostCool: "#3bd9ff",
|
||||
} as const;
|
||||
|
||||
// Procedural cover-art palette — the fixed colours of the generated
|
||||
// "no cover" artwork (missing / unmatched placeholders). Baked into an
|
||||
// SVG string by `utils/covers`, so they live here as the single home for
|
||||
|
||||
@@ -13,16 +13,18 @@
|
||||
// `useUISettings` still exposes `platformsGroupBy` for v1 — we just
|
||||
// don't surface it here.
|
||||
import { RIcon, RSelect, RSliderBtnGroup, RChip } from "@v2/lib";
|
||||
import { computed } from "vue";
|
||||
import { computed, ref } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { useUISettings } from "@/composables/useUISettings";
|
||||
import { useUiVersion } from "@/composables/useUiVersion";
|
||||
import storeCollections from "@/stores/collections";
|
||||
import CrtWarmup from "@/v2/components/AppShell/CrtWarmup.vue";
|
||||
import WidgetReorderList from "@/v2/components/Home/Widgets/WidgetReorderList.vue";
|
||||
import SettingsSection from "@/v2/components/Settings/SettingsSection.vue";
|
||||
import SettingsSubsection from "@/v2/components/Settings/SettingsSubsection.vue";
|
||||
import SettingsToggleRow from "@/v2/components/Settings/SettingsToggleRow.vue";
|
||||
import LanguageSelector from "@/v2/components/shared/LanguageSelector.vue";
|
||||
import { useCrtMode } from "@/v2/composables/useCrtMode";
|
||||
|
||||
const { t } = useI18n();
|
||||
const uiVersion = useUiVersion();
|
||||
@@ -77,6 +79,15 @@ function setTheme(value: Theme) {
|
||||
selectedTheme.value = value;
|
||||
}
|
||||
|
||||
// Cosmetic easter egg — toggle the persistent "CRT mode" shader; switching
|
||||
// it ON also fires the one-shot power-on warm-up flash.
|
||||
const { enabled: crtEnabled } = useCrtMode();
|
||||
const crtWarmup = ref<InstanceType<typeof CrtWarmup> | null>(null);
|
||||
function onCrtToggle(value: boolean) {
|
||||
crtEnabled.value = value;
|
||||
if (value) crtWarmup.value?.play();
|
||||
}
|
||||
|
||||
function setVersion(value: "v1" | "v2") {
|
||||
uiVersion.value = value;
|
||||
}
|
||||
@@ -162,6 +173,16 @@ function onVirtualCollectionTypeChange(value: unknown) {
|
||||
<span>{{ opt.label }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="r-v2-ui__toggle-grid r-v2-ui__toggle-grid--single r-v2-ui__toggle-grid--bordered"
|
||||
>
|
||||
<SettingsToggleRow
|
||||
:model-value="crtEnabled"
|
||||
:title="t('common.crt-mode')"
|
||||
:description="t('settings.crt-mode-desc')"
|
||||
@update:model-value="onCrtToggle"
|
||||
/>
|
||||
</div>
|
||||
</SettingsSection>
|
||||
|
||||
<!-- Home: sections + widgets, split into two subsections inside
|
||||
@@ -366,6 +387,10 @@ function onVirtualCollectionTypeChange(value: unknown) {
|
||||
</div>
|
||||
</div>
|
||||
</SettingsSection>
|
||||
|
||||
<!-- One-shot CRT power-on flash, fired when CRT mode is switched on
|
||||
from the Theme section above. -->
|
||||
<CrtWarmup ref="crtWarmup" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -401,6 +426,11 @@ function onVirtualCollectionTypeChange(value: unknown) {
|
||||
.r-v2-ui__toggle-grid--single {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
/* Separate a toggle grid from the control row above it (e.g. the CRT
|
||||
toggle sitting under the theme picker) with a hairline divider. */
|
||||
.r-v2-ui__toggle-grid--bordered {
|
||||
border-top: 1px solid var(--r-color-border);
|
||||
}
|
||||
html[data-bp~="xs"] .r-v2-ui__toggle-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user