Files
VFXdemo/index.html
2026-04-02 11:15:21 +08:00

705 lines
18 KiB
HTML

<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Shadervault — GLSL 展示</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Archivo:wght@600;700&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&display=swap"
rel="stylesheet"
/>
<style>
:root {
color-scheme: dark;
--bg-deep: #05060c;
--bg-mid: #0a0d16;
--bg-elevated: rgba(12, 15, 26, 0.88);
--border: rgba(118, 138, 215, 0.28);
--border-strong: rgba(148, 170, 255, 0.45);
--accent: #8fa8ff;
--accent-dim: rgba(143, 168, 255, 0.14);
--accent-glow: rgba(100, 140, 255, 0.35);
--text: #eef1fb;
--text-secondary: #a4adc8;
--text-muted: #6f7a96;
--radius-sm: 10px;
--radius-md: 14px;
--radius-lg: 18px;
--shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.35);
--shadow-card: 0 8px 32px rgba(0, 0, 0, 0.42);
--shadow-card-hover: 0 16px 48px rgba(36, 56, 140, 0.22);
--font-ui: "DM Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
--font-display: "Archivo", var(--font-ui);
--header-h: 64px;
}
* {
box-sizing: border-box;
}
html {
scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
html {
scroll-behavior: auto;
}
.card {
transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}
.card:hover {
transform: none !important;
}
}
body {
margin: 0;
width: 100%;
min-height: 100%;
background-color: var(--bg-deep);
background-image:
radial-gradient(ellipse 120% 80% at 50% -30%, rgba(88, 110, 200, 0.22), transparent 52%),
radial-gradient(ellipse 70% 50% at 100% 0%, rgba(60, 90, 180, 0.12), transparent 45%),
radial-gradient(ellipse 50% 40% at 0% 20%, rgba(40, 60, 120, 0.1), transparent 40%);
color: var(--text);
font-family: var(--font-ui);
font-size: 15px;
line-height: 1.5;
-webkit-font-smoothing: antialiased;
}
#app {
min-height: 100vh;
padding-bottom: 48px;
}
.site-header {
position: sticky;
top: 0;
z-index: 10;
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
min-height: var(--header-h);
padding: 12px 20px;
border-bottom: 1px solid var(--border);
background: linear-gradient(180deg, rgba(10, 12, 22, 0.94) 0%, rgba(8, 10, 18, 0.88) 100%);
backdrop-filter: blur(14px);
-webkit-backdrop-filter: blur(14px);
}
.brand-block {
display: flex;
flex-direction: column;
gap: 2px;
}
.brand {
font-family: var(--font-display);
font-size: 1.35rem;
font-weight: 700;
letter-spacing: 0.03em;
color: var(--text);
line-height: 1.2;
text-shadow: 0 0 24px var(--accent-glow);
}
.brand-sub {
font-size: 0.7rem;
font-weight: 500;
letter-spacing: 0.14em;
text-transform: uppercase;
color: var(--text-muted);
}
.header-right {
display: flex;
align-items: center;
gap: 12px;
flex: 1;
justify-content: flex-end;
max-width: min(560px, 100%);
}
.search-field {
position: relative;
flex: 1;
min-width: 0;
max-width: 320px;
}
.search-field svg {
position: absolute;
left: 12px;
top: 50%;
transform: translateY(-50%);
width: 18px;
height: 18px;
color: var(--text-muted);
pointer-events: none;
}
.search {
width: 100%;
padding: 10px 14px 10px 40px;
border-radius: 999px;
border: 1px solid var(--border);
background: rgba(255, 255, 255, 0.04);
color: var(--text);
font-family: inherit;
font-size: 0.875rem;
transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.search::placeholder {
color: var(--text-muted);
}
.search:hover {
border-color: rgba(148, 170, 255, 0.35);
background: rgba(255, 255, 255, 0.06);
}
.search:focus {
outline: none;
border-color: var(--border-strong);
box-shadow: 0 0 0 3px var(--accent-dim);
background: rgba(255, 255, 255, 0.07);
}
.main {
max-width: 1440px;
margin: 0 auto;
padding: 24px 20px 0;
}
.page-intro {
margin-bottom: 20px;
}
.page-title {
margin: 0 0 6px;
font-family: var(--font-display);
font-size: 1.5rem;
font-weight: 700;
letter-spacing: -0.02em;
color: var(--text);
}
.page-desc {
margin: 0;
font-size: 0.875rem;
color: var(--text-muted);
max-width: 52ch;
line-height: 1.55;
}
.toolbar {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: 14px;
margin-bottom: 16px;
}
.toolbar-actions {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 10px;
}
.chip {
display: inline-flex;
align-items: center;
padding: 6px 12px;
border-radius: 999px;
font-size: 0.75rem;
font-weight: 500;
letter-spacing: 0.02em;
color: var(--text-secondary);
background: rgba(255, 255, 255, 0.05);
border: 1px solid var(--border);
}
.chip strong {
color: var(--accent);
font-weight: 600;
margin-right: 4px;
}
button {
font-family: inherit;
cursor: pointer;
border-radius: var(--radius-sm);
font-size: 0.8125rem;
font-weight: 600;
padding: 9px 16px;
border: 1px solid var(--border);
background: rgba(255, 255, 255, 0.06);
color: var(--text);
transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}
button:hover {
background: rgba(255, 255, 255, 0.11);
border-color: rgba(148, 170, 255, 0.4);
}
button:active {
transform: scale(0.98);
}
button:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
.stats {
margin-bottom: 20px;
padding: 12px 16px;
border-radius: var(--radius-md);
border: 1px solid var(--border);
background: linear-gradient(135deg, rgba(20, 24, 42, 0.6) 0%, rgba(12, 14, 24, 0.85) 100%);
font-size: 0.8125rem;
color: var(--text-secondary);
box-shadow: var(--shadow-sm);
}
.preview-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
gap: 16px;
}
.card {
content-visibility: auto;
contain-intrinsic-size: 300px 220px;
border: 1px solid var(--border);
border-radius: var(--radius-lg);
overflow: hidden;
background: linear-gradient(165deg, rgba(22, 26, 44, 0.95) 0%, rgba(10, 12, 22, 0.98) 100%);
box-shadow: var(--shadow-card);
transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
cursor: pointer;
}
.card:hover {
transform: translateY(-3px);
border-color: rgba(148, 170, 255, 0.5);
box-shadow: var(--shadow-card-hover);
}
.card:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 3px;
}
.card-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
padding: 12px 14px;
font-size: 0.8125rem;
color: var(--text-secondary);
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
background: rgba(0, 0, 0, 0.2);
}
.card-head strong {
font-family: var(--font-display);
font-size: 0.9375rem;
font-weight: 600;
color: var(--text);
letter-spacing: -0.01em;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.card-stage {
position: relative;
width: 100%;
aspect-ratio: 16 / 10;
background: #020308;
overflow: hidden;
}
.card-stage::after {
content: "";
position: absolute;
inset: 0;
pointer-events: none;
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
border-radius: 0;
}
.card-thumb {
width: 100%;
height: 100%;
display: block;
object-fit: cover;
}
.card-hover-canvas {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: block;
pointer-events: none;
}
.card-thumb--placeholder {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 120px;
padding: 16px;
text-align: center;
font-size: 0.8125rem;
line-height: 1.55;
color: var(--text-muted);
background: linear-gradient(155deg, #0c0e18 0%, #14182a 100%);
}
.card-thumb--placeholder small {
margin-top: 6px;
font-size: 0.7rem;
opacity: 0.85;
}
.card-meta {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
padding: 10px 14px 12px;
font-size: 0.75rem;
color: var(--text-muted);
}
.card-meta-left {
min-width: 0;
flex: 1;
}
.card-meta-author {
color: var(--text-secondary);
font-weight: 500;
}
.card-meta-stats {
display: flex;
align-items: center;
gap: 10px;
flex-shrink: 0;
}
.stat-pill {
display: inline-flex;
align-items: center;
gap: 5px;
font-size: 0.72rem;
font-weight: 600;
letter-spacing: 0.02em;
color: var(--text-secondary);
}
.stat-like {
margin: 0;
padding: 5px 9px;
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 10px;
background: rgba(255, 255, 255, 0.05);
cursor: pointer;
font: inherit;
color: inherit;
transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.stat-like:hover:not(:disabled) {
background: rgba(255, 255, 255, 0.1);
border-color: rgba(148, 170, 255, 0.35);
}
.stat-like:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
.stat-like.is-liked {
color: #ff9aab;
border-color: rgba(255, 150, 170, 0.35);
background: rgba(255, 90, 120, 0.12);
cursor: default;
}
.stat-ico {
width: 15px;
height: 15px;
flex-shrink: 0;
opacity: 0.9;
}
.stat-like.is-liked .stat-ico-heart {
opacity: 1;
}
.error {
color: #ff9a9a;
font-size: 0.75rem;
white-space: pre-wrap;
}
.detail-view {
position: fixed;
inset: 0;
z-index: 20;
display: none;
grid-template-rows: auto 1fr;
background: var(--bg-deep);
}
.detail-view.active {
display: grid;
}
.detail-topbar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 14px 18px;
border-bottom: 1px solid var(--border);
background: linear-gradient(180deg, rgba(14, 16, 26, 0.98) 0%, rgba(8, 10, 18, 0.95) 100%);
backdrop-filter: blur(10px);
}
.detail-title-wrap {
display: flex;
flex-direction: column;
gap: 4px;
min-width: 0;
}
.detail-view #detail-title {
font-family: var(--font-display);
font-size: 1.05rem;
font-weight: 600;
color: var(--text);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.detail-fps-pill {
display: inline-flex;
align-items: center;
width: fit-content;
padding: 2px 8px;
border-radius: 6px;
font-size: 0.7rem;
font-weight: 600;
letter-spacing: 0.04em;
color: var(--text-muted);
background: rgba(255, 255, 255, 0.06);
border: 1px solid rgba(255, 255, 255, 0.08);
}
#detail-fps {
margin-left: 0 !important;
color: var(--accent) !important;
font-size: inherit !important;
}
#back-btn {
flex-shrink: 0;
border-radius: 999px;
padding: 10px 20px;
background: var(--accent-dim);
border-color: rgba(148, 170, 255, 0.35);
color: var(--text);
}
#back-btn:hover {
background: rgba(143, 168, 255, 0.22);
border-color: rgba(148, 170, 255, 0.55);
}
.detail-stage {
width: 100%;
min-height: 0;
height: calc(100vh - 72px);
display: flex;
align-items: center;
justify-content: center;
background: radial-gradient(ellipse at 50% 30%, rgba(30, 40, 80, 0.25), transparent 55%), #000;
}
.detail-stage canvas {
width: 100%;
height: 100%;
display: block;
max-height: 100%;
background: #000;
}
.modal {
position: fixed;
inset: 0;
z-index: 30;
display: none;
place-items: center;
background: rgba(4, 6, 10, 0.75);
backdrop-filter: blur(6px);
}
.modal.active {
display: grid;
}
.modal-card {
width: min(900px, 92vw);
max-height: 90vh;
overflow: auto;
border: 1px solid var(--border-strong);
border-radius: var(--radius-lg);
background: #0c0f1a;
padding: 16px;
}
.modal-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px;
}
.modal-grid input,
.modal-grid textarea {
width: 100%;
border: 1px solid var(--border);
background: rgba(255, 255, 255, 0.04);
color: #fff;
border-radius: var(--radius-sm);
padding: 8px;
}
.modal-grid textarea {
min-height: 220px;
resize: vertical;
grid-column: 1 / -1;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
}
.table {
margin-top: 10px;
border: 1px solid var(--border);
border-radius: var(--radius-md);
overflow: hidden;
}
.row-item {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
padding: 8px 10px;
border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.row-item:first-child {
border-top: 0;
}
@media (max-width: 640px) {
.site-header {
flex-wrap: wrap;
}
.header-right {
width: 100%;
max-width: none;
}
.search-field {
max-width: none;
}
.page-title {
font-size: 1.25rem;
}
}
</style>
</head>
<body>
<header class="site-header">
<div class="brand-block">
<span class="brand">Shadervault</span>
<span class="brand-sub">GLSL gallery</span>
</div>
<div class="header-right">
<label class="search-field">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<circle cx="11" cy="11" r="7" />
<path d="m21 21-4.35-4.35" />
</svg>
<input
id="search-input"
class="search"
type="search"
placeholder="搜索名称或作者…"
autocomplete="off"
aria-label="搜索 shader"
/>
</label>
</div>
</header>
<div id="app">
<main class="main">
<div class="page-intro">
<h1 class="page-title">精选着色器</h1>
<p class="page-desc">悬停实时预览,点击进入全屏。</p>
</div>
<div class="toolbar">
<div class="toolbar-actions">
<span class="chip" id="shader-count-wrap"><strong id="shader-count">0</strong> 个着色器</span>
<button type="button" id="pause-btn">全局暂停</button>
<button type="button" id="reset-btn">重置时间</button>
<span class="chip" aria-live="polite"><strong>FPS</strong> <span id="global-fps"></span></span>
</div>
</div>
<div class="stats" id="stats">准备就绪</div>
<section id="preview-grid" class="preview-grid" aria-label="Shader 列表"></section>
</main>
</div>
<section id="detail-view" class="detail-view" aria-hidden="true">
<div class="detail-topbar">
<div class="detail-title-wrap">
<strong id="detail-title">特效详情</strong>
<span class="detail-fps-pill">实时 <span id="detail-fps">FPS —</span></span>
</div>
<button type="button" id="back-btn">返回列表</button>
</div>
<div class="detail-stage">
<canvas id="detail-canvas" aria-label="全屏 shader 预览"></canvas>
</div>
</section>
<script src="./thumb-renderer.js"></script>
<script src="./display.js"></script>
</body>
</html>