修改cad和pcb的loading

This commit is contained in:
2026-10-30 19:59:30 +08:00
parent e0416b4064
commit eb12b23550
2 changed files with 167 additions and 2 deletions
+84 -1
View File
@@ -10,9 +10,64 @@
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<link rel="manifest" href="/site.webmanifest">
<link rel="stylesheet" href="/css/fonts.css">
<style>
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
:root {
--cad-bg: #07080a;
--cad-dim: #5c636c;
--cad-soft: #c9cdd3;
--cad-font: 'Sora', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
--cad-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--cad-bg); }
#cad-frame { position: fixed; inset: 0; display: block; width: 100vw; height: 100vh; height: 100dvh; border: 0; }
.cad-splash {
position: fixed;
inset: 0;
z-index: 1;
display: grid;
place-items: center;
overflow: hidden;
background: var(--cad-bg);
color: var(--cad-soft);
font-family: var(--cad-font);
transition: opacity .7s ease, visibility .7s;
}
.cad-splash::before {
content: '';
position: absolute;
inset: 0;
pointer-events: none;
background:
radial-gradient(40% 35% at 50% 45%, rgba(200, 255, 62, .07), transparent 70%),
linear-gradient(rgba(255, 255, 255, .03) 1px, transparent 1px) 50% 50% / 80px 80px,
linear-gradient(90deg, rgba(255, 255, 255, .03) 1px, transparent 1px) 50% 50% / 80px 80px;
-webkit-mask-image: radial-gradient(50% 50% at 50% 50%, #000, transparent 85%);
mask-image: radial-gradient(50% 50% at 50% 50%, #000, transparent 85%);
}
.cad-splash-inner { position: relative; display: grid; justify-items: center; transition: transform .8s cubic-bezier(.6, 0, .2, 1), opacity .5s; }
.cad-splash-mark { position: relative; width: 240px; height: 90px; }
.cad-splash-logo { display: block; width: 100%; height: 100%; object-fit: contain; }
.cad-splash-logo-base { opacity: .12; filter: grayscale(1); }
.cad-splash-logo-fill { position: absolute; inset: 0; clip-path: inset(0 var(--cad-splash-unrevealed, 100%) 0 0); transition: clip-path .12s linear; }
.cad-splash-foot {
position: absolute;
right: 40px;
bottom: 32px;
left: 40px;
display: flex;
align-items: end;
justify-content: space-between;
color: var(--cad-dim);
font-family: var(--cad-mono);
font-size: 11px;
letter-spacing: .18em;
}
.cad-splash-pct { color: var(--cad-soft); font-size: 13px; letter-spacing: .1em; font-variant-numeric: tabular-nums; }
.cad-splash.out { visibility: hidden; pointer-events: none; opacity: 0; }
.cad-splash.out .cad-splash-inner { transform: translateY(-14px) scale(.97); opacity: 0; }
@media (max-width: 820px) { .cad-splash-foot { right: 16px; bottom: 16px; left: 16px; } .cad-splash-foot span:first-child { display: none; } }
@media (prefers-reduced-motion: reduce) { .cad-splash, .cad-splash-inner, .cad-splash-logo-fill { transition: none; } }
</style>
</head>
<body>
@@ -23,9 +78,37 @@
allow="clipboard-read; clipboard-write; fullscreen"
allowfullscreen
referrerpolicy="strict-origin-when-cross-origin"></iframe>
<div class="cad-splash" id="cad-splash" aria-hidden="true">
<div class="cad-splash-inner">
<div class="cad-splash-mark">
<img class="cad-splash-logo cad-splash-logo-base" fetchpriority="high" src="/assets/brand/make-web-768.png" srcset="/assets/brand/make-web-256.png 256w, /assets/brand/make-web-384.png 384w, /assets/brand/make-web-512.png 512w, /assets/brand/make-web-768.png 768w" sizes="240px" width="240" height="90" alt="">
<img class="cad-splash-logo cad-splash-logo-fill" fetchpriority="high" src="/assets/brand/make-web-768.png" srcset="/assets/brand/make-web-256.png 256w, /assets/brand/make-web-384.png 384w, /assets/brand/make-web-512.png 512w, /assets/brand/make-web-768.png 768w" sizes="240px" width="240" height="90" alt="">
</div>
</div>
<div class="cad-splash-foot"><span>OPEN ROBOTICS COMMUNITY</span><span class="cad-splash-pct">000</span></div>
</div>
<script>
const cadFrame = document.getElementById('cad-frame');
const cadSplash = document.getElementById('cad-splash');
const cadOrigin = new URL(cadFrame.dataset.desktopSrc, document.baseURI).origin;
const splashDuration = 3000;
const splashStartedAt = performance.now();
const splashPct = cadSplash.querySelector('.cad-splash-pct');
function updateCadSplash(now) {
const progress = Math.min(1, (now - splashStartedAt) / splashDuration);
cadSplash.style.setProperty('--cad-splash-unrevealed', `${(1 - progress) * 100}%`);
splashPct.textContent = String(Math.round(progress * 100)).padStart(3, '0');
if (progress < 1) {
requestAnimationFrame(updateCadSplash);
return;
}
cadSplash.classList.add('out');
window.setTimeout(() => cadSplash.remove(), 750);
}
requestAnimationFrame(updateCadSplash);
window.addEventListener('message', (event) => {
if (event.source !== cadFrame.contentWindow
|| event.origin !== cadOrigin
+83 -1
View File
@@ -10,9 +10,64 @@
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<link rel="manifest" href="/site.webmanifest">
<link rel="stylesheet" href="/css/fonts.css">
<style>
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
:root {
--pcb-bg: #07080a;
--pcb-dim: #5c636c;
--pcb-soft: #c9cdd3;
--pcb-font: 'Sora', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
--pcb-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--pcb-bg); }
#pcb-frame { position: fixed; inset: 0; display: block; width: 100vw; height: 100vh; height: 100dvh; border: 0; }
.pcb-splash {
position: fixed;
inset: 0;
z-index: 1;
display: grid;
place-items: center;
overflow: hidden;
background: var(--pcb-bg);
color: var(--pcb-soft);
font-family: var(--pcb-font);
transition: opacity .7s ease, visibility .7s;
}
.pcb-splash::before {
content: '';
position: absolute;
inset: 0;
pointer-events: none;
background:
radial-gradient(40% 35% at 50% 45%, rgba(200, 255, 62, .07), transparent 70%),
linear-gradient(rgba(255, 255, 255, .03) 1px, transparent 1px) 50% 50% / 80px 80px,
linear-gradient(90deg, rgba(255, 255, 255, .03) 1px, transparent 1px) 50% 50% / 80px 80px;
-webkit-mask-image: radial-gradient(50% 50% at 50% 50%, #000, transparent 85%);
mask-image: radial-gradient(50% 50% at 50% 50%, #000, transparent 85%);
}
.pcb-splash-inner { position: relative; display: grid; justify-items: center; transition: transform .8s cubic-bezier(.6, 0, .2, 1), opacity .5s; }
.pcb-splash-mark { position: relative; width: 240px; height: 90px; }
.pcb-splash-logo { display: block; width: 100%; height: 100%; object-fit: contain; }
.pcb-splash-logo-base { opacity: .12; filter: grayscale(1); }
.pcb-splash-logo-fill { position: absolute; inset: 0; clip-path: inset(0 var(--pcb-splash-unrevealed, 100%) 0 0); transition: clip-path .12s linear; }
.pcb-splash-foot {
position: absolute;
right: 40px;
bottom: 32px;
left: 40px;
display: flex;
align-items: end;
justify-content: space-between;
color: var(--pcb-dim);
font-family: var(--pcb-mono);
font-size: 11px;
letter-spacing: .18em;
}
.pcb-splash-pct { color: var(--pcb-soft); font-size: 13px; letter-spacing: .1em; font-variant-numeric: tabular-nums; }
.pcb-splash.out { visibility: hidden; pointer-events: none; opacity: 0; }
.pcb-splash.out .pcb-splash-inner { transform: translateY(-14px) scale(.97); opacity: 0; }
@media (max-width: 820px) { .pcb-splash-foot { right: 16px; bottom: 16px; left: 16px; } .pcb-splash-foot span:first-child { display: none; } }
@media (prefers-reduced-motion: reduce) { .pcb-splash, .pcb-splash-inner, .pcb-splash-logo-fill { transition: none; } }
</style>
</head>
<body>
@@ -23,8 +78,35 @@
allow="clipboard-read; clipboard-write; fullscreen"
allowfullscreen
referrerpolicy="strict-origin-when-cross-origin"></iframe>
<div class="pcb-splash" id="pcb-splash" aria-hidden="true">
<div class="pcb-splash-inner">
<div class="pcb-splash-mark">
<img class="pcb-splash-logo pcb-splash-logo-base" fetchpriority="high" src="/assets/brand/make-web-768.png" srcset="/assets/brand/make-web-256.png 256w, /assets/brand/make-web-384.png 384w, /assets/brand/make-web-512.png 512w, /assets/brand/make-web-768.png 768w" sizes="240px" width="240" height="90" alt="">
<img class="pcb-splash-logo pcb-splash-logo-fill" fetchpriority="high" src="/assets/brand/make-web-768.png" srcset="/assets/brand/make-web-256.png 256w, /assets/brand/make-web-384.png 384w, /assets/brand/make-web-512.png 512w, /assets/brand/make-web-768.png 768w" sizes="240px" width="240" height="90" alt="">
</div>
</div>
<div class="pcb-splash-foot"><span>OPEN ROBOTICS COMMUNITY</span><span class="pcb-splash-pct">000</span></div>
</div>
<script>
const pcbFrame = document.getElementById('pcb-frame');
const pcbSplash = document.getElementById('pcb-splash');
const splashDuration = 3000;
const splashStartedAt = performance.now();
const splashPct = pcbSplash.querySelector('.pcb-splash-pct');
function updatePcbSplash(now) {
const progress = Math.min(1, (now - splashStartedAt) / splashDuration);
pcbSplash.style.setProperty('--pcb-splash-unrevealed', `${(1 - progress) * 100}%`);
splashPct.textContent = String(Math.round(progress * 100)).padStart(3, '0');
if (progress < 1) {
requestAnimationFrame(updatePcbSplash);
return;
}
pcbSplash.classList.add('out');
window.setTimeout(() => pcbSplash.remove(), 750);
}
requestAnimationFrame(updatePcbSplash);
window.addEventListener('message', (event) => {
if (event.source !== pcbFrame.contentWindow
|| event.origin !== new URL(pcbFrame.dataset.desktopSrc, document.baseURI).origin