Scramble loader
Black opening screen with a serif LOADING word, mono fragments decoding around it and a counting hairline gauge.
Part of the style
Pewter Haze Readout
7 parts that belong together, with their tokens, type and rules.
https://kitbash.me/components/pewter-haze-readout/loader/figma.html?palette=bbecc5d76de4e25d
Use the Figma MCP server (https://mcp.figma.com/mcp). Download https://kitbash.me/components/pewter-haze-readout/loader/figma.html?palette=bbecc5d76de4e25d and pass that whole HTML document to the html_to_figma tool, so the part "Scramble loader" lands as editable layers in my open Figma file. Fonts come from Google Fonts: if a face is missing in Figma, pick the closest one.
Code
<style>
/* Goes after the pack's base.css */
:root {
--fog-core: #6e696c;
--fog-mid: #959093;
--fog-edge: #c2bdc0;
--night: #c2bdc0;
--ink: #0e1217;
--ink-soft: rgba(14, 18, 23, 0.62);
--ink-faint: rgba(14, 18, 23, 0.28);
--veil: rgba(14, 18, 23, 0.08);
--shade: rgba(194, 189, 192, 0.35);
--iris-a: #213452;
--iris-b: #3b4559;
--iris-c: #8f806a;
--iris-d: #213452;
}
</style>
<section class="loader" aria-label="Loading screen">
<div class="loader__center">
<p class="loader__frag loader__frag--n" data-text="Kelda / light & sound">Kelda / light & sound</p>
<p class="loader__frag loader__frag--w" data-text="Signal warm">Signal warm</p>
<h2 class="loader__word">Loading</h2>
<p class="loader__frag loader__frag--e" data-text="Lens 04 ready">Lens 04 ready</p>
<p class="loader__frag loader__frag--s" data-text="52°N — 4°E">52°N — 4°E</p>
</div>
<div class="loader__gauge" role="progressbar" aria-label="Loading progress" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">
<span class="loader__fill"></span>
<span class="loader__count">0%</span>
</div>
</section>
<style>
.loader {
position: relative;
display: grid;
place-items: center;
min-height: clamp(26rem, 52vw, 45rem);
padding: var(--section) var(--edge);
background: var(--night);
color: var(--ink);
overflow: hidden;
}
.loader__center {
position: relative;
display: grid;
grid-template-columns: auto auto auto;
grid-template-areas: ". n ." "w word e" ". s .";
align-items: center;
justify-items: center;
gap: var(--space-xs) var(--space-s);
}
.loader__word {
grid-area: word;
margin: 0;
font: 400 var(--display-m)/1 var(--font-display);
letter-spacing: var(--track-display);
text-transform: uppercase;
}
.loader__frag {
margin: 0;
color: var(--ink-soft);
font-size: var(--text-s);
white-space: nowrap;
}
.loader__frag--n { grid-area: n; }
.loader__frag--w { grid-area: w; justify-self: end; }
.loader__frag--e { grid-area: e; justify-self: start; }
.loader__frag--s { grid-area: s; }
.loader__gauge {
position: absolute;
inset: auto var(--edge) var(--edge);
height: 6px;
border: var(--line) solid var(--ink-faint);
}
.loader__fill {
position: absolute;
inset: 1px auto 1px 1px;
width: calc((100% - 2px) * var(--progress, 0));
background: var(--ink);
}
.loader__count {
position: absolute;
top: calc(100% + var(--space-xs));
left: calc(100% * var(--progress, 0));
translate: -100% 0;
font-size: var(--text-s);
}
.loader.is-done .loader__center {
opacity: 0.25;
transition: opacity var(--glide) var(--ease);
}
@media (max-width: 40rem) {
.loader__center {
grid-template-columns: auto;
grid-template-areas: "n" "w" "word" "e" "s";
}
.loader__frag--w, .loader__frag--e { justify-self: center; }
}
</style>
<script>
(() => {
const glyphs = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789*/<>#%&';
const still = matchMedia('(prefers-reduced-motion: reduce)');
function scramble(el, step) {
const text = el.dataset.text;
let frame = 0;
clearInterval(el._timer);
el._timer = setInterval(() => {
frame += 1;
el.textContent = [...text].map((ch, i) => (ch === ' ' || i < frame / 2 ? ch : glyphs[Math.floor(Math.random() * glyphs.length)])).join('');
if (frame / 2 >= text.length) { clearInterval(el._timer); el.textContent = text; }
}, step);
}
for (const root of document.querySelectorAll('.loader')) {
const gauge = root.querySelector('.loader__gauge');
const count = root.querySelector('.loader__count');
const frags = root.querySelectorAll('.loader__frag');
const step = parseFloat(getComputedStyle(root).getPropertyValue('--scramble')) || 28;
let start = 0;
let frame = 0;
const set = (p) => {
root.style.setProperty('--progress', p);
const pct = Math.round(p * 100);
count.textContent = pct + '%';
gauge.setAttribute('aria-valuenow', pct);
};
if (still.matches) { set(1); continue; }
const tick = (now) => {
if (!start) { start = now; root.classList.remove('is-done'); frags.forEach((f) => scramble(f, step)); }
const t = Math.min(1, (now - start) / 2400);
set(1 - Math.pow(1 - t, 2.2));
if (t >= 1) {
root.classList.add('is-done');
if (now - start > 4200) start = 0;
}
frame = requestAnimationFrame(tick);
};
new IntersectionObserver(([entry]) => {
cancelAnimationFrame(frame);
if (entry.isIntersecting) { start = 0; frame = requestAnimationFrame(tick); }
}).observe(root);
}
})();
</script>