Preloaders and Page Loading Screens
Updated 2026-10-16. 10 effects.
A preloader is a screen that covers the page while it loads, then moves away to reveal it. A good one reports real progress, such as images decoded, instead of a fake timer, finishes the moment the page is ready, and never traps people behind a long intro. These leave with transform and opacity only.
Most pages do not need a preloader at all; a fast page beats a pretty wait. They make sense for image-heavy portfolios, galleries and campaign pages where showing half-loaded photos would look worse than a brief, deliberate cover. If you add one, cap it: these all lift as soon as the page is ready and never later than a few seconds.
Pick the exit to suit the brand. Shutters and wipes feel crisp, a counter that hands over to the headline suits studios, and a soft fade suits anything calm. For small inline spinners and progress rings inside buttons and cards, use the loaders and spinners set instead; this collection is for whole-screen intros.
Compare them
| Effect | Built with | Size (gzipped) | Running cost | Browser support |
|---|---|---|---|---|
| Bakery Layered Lift Preloader | CSS and a small script | 3.4 KB | Three full-size layers translate once with staggered delays, then the cover is taken out of the page. | All current browsers |
| Espresso Circle Shrink Preloader | CSS and a small script | 3.5 KB | One large disc scales once and a small bean turns on a CSS loop that is paused off screen. | All current browsers |
| Forest Curved Curtain Preloader | CSS and a small script | 3.5 KB | One layer and its curved hem lift together by transform, so the hem costs nothing extra to move. | All current browsers |
| Graphite Shutter Preloader | CSS and a small script | 3.5 KB | Six flat layers move by transform once, and the progress loop only runs while images are still loading. | All current browsers |
| Linen Mat Aperture Preloader | CSS and a small script | 3.2 KB | Four flat sides slide by transform and one photo scales; the window shadow is drawn once and only faded. | All current browsers |
| Navy Split Halves Preloader | CSS and a small script | 3.4 KB | Two half-height layers and one photo move by transform, and the hairline is a single scaled line. | All current browsers |
| Paper Counter Handover Preloader | CSS and a small script | 3.2 KB | Text and one photo move by transform; the counter updates its text a few dozen times and then stops. | All current browsers |
| Sand Tile Mosaic Preloader | CSS and a small script | 3.3 KB | Twenty-four small layers scale and fade once each; nothing repaints after the sweep ends. | All current browsers |
| Slate Checklist Preloader | CSS and a small script | 3.6 KB | Each tick is a class swap on one row, and the only loop is the short one easing the bar. | All current browsers |
| Terracotta Double Wipe Preloader | CSS and a small script | 3.4 KB | Two full-size layers translate once and two photos fade in; no loop runs after the reveal. | All current browsers |
Bakery Layered Lift Preloader
Three coloured sheets, rye brown on top, crust orange and flour cream beneath, cover a bakery homepage while its two bread photos load. When both have arrived the sheets lift one after another, so the colours flash past like layers of a loaf before the page appears. Opening hours sit in real text below the headline.
<section class="w2stk">
<div class="w2stk-page" data-page="" aria-busy="true">
<header class="w2stk-nav">
<a href="#" class="w2stk-brand">Bramble Street Bakery</a>
<a href="#" class="w2stk-link">Order for Saturday</a>
</header>
<div class="w2stk-hero">
<div class="w2stk-text">
<h2 class="w2stk-title">Sourdough out of the oven by seven.</h2>
<p class="w2stk-copy">Country loaves, rye and a short list of pastries, baked through the night in a stone deck oven.</p>
<dl class="w2stk-hours"><div><dt>Tue to Fri</dt><dd>7 am to 3 pm</dd></div><div><dt>Sat and Sun</dt><dd>8 am to 1 pm</dd></div></dl>
<button type="button" class="w2stk-replay" data-replay="">
<svg viewBox="0 0 20 20" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 10a6 6 0 1 0 1.8-4.3" /><path d="M4 3.5v3.2h3.2" /></svg>
Replay intro
</button>
</div>
<div class="w2stk-pics">
<img class="w2stk-a" src="https://images.pexels.com/photos/1383908/pexels-photo-1383908.jpeg?auto=compress&cs=tinysrgb&w=1200" alt="Rows of crusty rustic bread loaves stacked on a wooden board" width="1200" height="800" />
<img class="w2stk-b" src="https://images.pexels.com/photos/10481790/pexels-photo-10481790.jpeg?auto=compress&cs=tinysrgb&w=800" alt="Round loaves baking on the shelves of a lit commercial oven" width="800" height="530" />
</div>
</div>
</div>
<div class="w2stk-cover" data-cover="" aria-hidden="true">
<span class="w2stk-l3"></span>
<span class="w2stk-l2"></span>
<div class="w2stk-l1">
<p class="w2stk-word">Bramble Street</p>
<p class="w2stk-pct">Warming the oven <span data-num="">0</span>%</p>
</div>
</div>
<p class="w2stk-sr" data-live="" aria-live="polite"></p>
</section>
<style>
/* Change these: colours of the cover and the page. */
.w2stk { --w2stk-rye: #3b2517; --w2stk-crust: #c7843f; --w2stk-flour: #f3e9d6; height: 600px; background: var(--w2stk-flour); color: #2c1c11; font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif; }
.w2stk-page { height: 100%; display: flex; flex-direction: column; padding: 0 clamp(16px, 4vw, 48px); }
.w2stk-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 72px; }
.w2stk-brand { color: inherit; font-family: ui-serif, Georgia, 'Times New Roman', serif; font-size: 20px; font-weight: 700; text-decoration: none; }
.w2stk-link { display: inline-flex; align-items: center; min-height: 40px; color: #8a4b17; font-size: 14px; font-weight: 600; text-underline-offset: 4px; }
.w2stk-hero { flex: 1; display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(20px, 4vw, 56px); align-items: center; min-height: 0; padding-bottom: 24px; }
.w2stk-title { margin: 0; font-family: ui-serif, Georgia, 'Times New Roman', serif; font-size: clamp(32px, 4.6vw, 58px); line-height: 1.02; font-weight: 700; letter-spacing: -.015em; }
.w2stk-copy { margin: 16px 0 0; font-size: 16px; line-height: 1.6; color: #5a4331; max-width: 28rem; }
.w2stk-hours { display: flex; gap: 28px; margin: 20px 0 22px; }
.w2stk-hours dt { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: #7a5a3f; }
.w2stk-hours dd { margin: 4px 0 0; font-size: 15px; font-weight: 600; }
.w2stk-replay { border: 1px solid #d8c19e; background: #fbf5ea; color: #2c1c11; }
.w2stk-pics { position: relative; height: 100%; max-height: 440px; }
.w2stk-pics img { position: absolute; object-fit: cover; display: block; border-radius: 4px; }
.w2stk-a { top: 0; right: 0; width: 86%; height: 78%; transform: translateY(30px); transition: transform 1.1s cubic-bezier(.2,.75,.15,1) .5s; }
.w2stk-b { left: 0; bottom: 0; width: 46%; height: 40%; border: 6px solid var(--w2stk-flour); box-shadow: 0 20px 40px -18px rgba(60,35,15,.5); transform: translateY(60px); transition: transform 1.1s cubic-bezier(.2,.75,.15,1) .6s; }
.w2stk.is-out .w2stk-a, .w2stk.is-out .w2stk-b { transform: none; }
.w2stk-cover { position: absolute; inset: 0; z-index: 2; }
.w2stk-l1, .w2stk-l2, .w2stk-l3 { position: absolute; inset: 0; transition: transform .8s cubic-bezier(.76,0,.24,1); }
.w2stk-l3 { background: var(--w2stk-flour); transition-delay: .26s; box-shadow: 0 10px 0 #e2d3b8; }
.w2stk-l2 { background: var(--w2stk-crust); transition-delay: .13s; }
.w2stk-l1 { background: var(--w2stk-rye); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--w2stk-flour); }
.w2stk.is-out .w2stk-l1, .w2stk.is-out .w2stk-l2, .w2stk.is-out .w2stk-l3 { transform: translateY(-104%); }
.w2stk-word { margin: 0; font-family: ui-serif, Georgia, 'Times New Roman', serif; font-size: clamp(44px, 9vw, 110px); font-weight: 700; letter-spacing: -.02em; text-align: center; line-height: 1; padding: 0 16px; }
.w2stk-pct { margin: 0; font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: #e0c39b; font-variant-numeric: tabular-nums; }
@media (max-width: 767px) {
.w2stk-nav { height: 64px; }
.w2stk-brand { font-size: 17px; }
.w2stk-hero { grid-template-columns: 1fr; align-content: start; gap: 18px; }
.w2stk-pics { height: 160px; order: -1; }
.w2stk-b { display: none; }
.w2stk-a { width: 100%; height: 100%; }
.w2stk-copy { font-size: 15px; margin-top: 12px; }
.w2stk-hours { margin: 14px 0 16px; }
}
.w2stk { position: relative; overflow: hidden; }
.w2stk-cover[hidden] { display: none; }
.w2stk.is-snap, .w2stk.is-snap * { transition: none !important; }
.w2stk[data-paused] * { animation-play-state: paused !important; }
.w2stk-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.w2stk-replay { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px; font: 600 13px/1 ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
.w2stk-replay:focus-visible, .w2stk a:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
.w2stk *, .w2stk *::before, .w2stk *::after { animation: none !important; transition-duration: 0s !important; transition-delay: 0s !important; }
.w2stk .w2stk-cover { transition: opacity .45s ease !important; }
.w2stk.is-out .w2stk-cover { opacity: 0; }
.w2stk-cover *:not([data-bar]), .w2stk-page * { transform: none !important; opacity: 1; }
}
</style>
<script>
(function () {
/* Change these: shortest time the cover shows (ms), longest it may wait for images (ms), exit length (ms). */
var MIN = 900, CAP = 1500, EXIT = 1100;
/* On a real page: give .w2stk-cover position: fixed; inset: 0 and put data-page on your <main>. */
var root = document.querySelector(".w2stk");
if (!root) return;
var page = root.querySelector("[data-page]"), cover = root.querySelector("[data-cover]");
var live = root.querySelector("[data-live]"), again = root.querySelector("[data-replay]");
var nums = root.querySelectorAll("[data-num]"), bars = root.querySelectorAll("[data-bar]"), ticks = root.querySelectorAll("[data-tick]");
var rm = matchMedia("(prefers-reduced-motion: reduce)"), run = 0, frame = 0, seen = true, step = null, timer = 0;
function draw(v) {
var t = String(Math.round(v * 100));
nums.forEach(function (n) { n.textContent = t; });
bars.forEach(function (b) { b.style.transform = "scaleX(" + v + ")"; });
}
function start(refocus) {
var id = ++run, t0 = performance.now(), imgs = page.querySelectorAll("img"), total = imgs.length, done = 0, shown = 0;
cancelAnimationFrame(frame); clearTimeout(timer);
root.classList.add("is-snap"); root.classList.remove("is-out");
cover.hidden = false; void root.offsetWidth; root.classList.remove("is-snap");
page.inert = true; page.setAttribute("aria-busy", "true"); live.textContent = "Loading";
ticks.forEach(function (k) { k.classList.remove("is-on"); });
/* Real progress: one step per image that fires load or error. */
imgs.forEach(function (img, i) {
function hit() { if (id !== run) return; done++; if (ticks[i]) ticks[i].classList.add("is-on"); }
if (img.complete) hit(); else { img.addEventListener("load", hit, { once: true }); img.addEventListener("error", hit, { once: true }); }
});
step = function (now) {
var real = total ? done / total : 1, t = now - t0;
if (t > CAP) real = 1;
shown += (real - shown) * (rm.matches ? 1 : 0.2);
if (real - shown < 0.004) shown = real;
draw(shown);
if (shown === 1 && t >= MIN) {
step = null; frame = 0;
root.classList.add("is-out"); live.textContent = "Page ready";
page.inert = false; page.removeAttribute("aria-busy");
timer = setTimeout(function () { cover.hidden = true; if (refocus) again.focus(); }, rm.matches ? 500 : EXIT);
return;
}
frame = seen ? requestAnimationFrame(step) : 0;
};
frame = requestAnimationFrame(step);
}
/* Off screen: stop the frame loop and pause CSS loops. */
new IntersectionObserver(function (e) {
seen = e[0].isIntersecting;
root.toggleAttribute("data-paused", !seen);
if (seen && step && !frame) frame = requestAnimationFrame(step);
}).observe(root);
again.addEventListener("click", function () { start(true); });
start(false);
})();
</script>
With reduced motion: None of the sheets lift; the stack fades out once and the bakery page is already settled.
Running cost: Three full-size layers translate once with staggered delays, then the cover is taken out of the page.
- Set the three sheet colours with `--w2stk-rye`, `--w2stk-crust` and `--w2stk-flour`.
- Space the layers further apart by raising the `.13s` and `.26s` delays on `.w2stk-l2` and `.w2stk-l3`.
- Edit the opening times in the `.w2stk-hours` list; each pair is a term and its value.
Espresso Circle Shrink Preloader
An espresso-dark disc fills the box with a turning coffee bean and a percentage of the page's photos loaded. When they are ready, the disc shrinks into the round dot of the logo, and the arched roaster photo and round bean photo grow into place. A warm, rounded choice for cafes and roasters whose brand already uses circles.
<section class="w2cir">
<div class="w2cir-page" data-page="" aria-busy="true">
<header class="w2cir-nav">
<a href="#" class="w2cir-brand"><span class="w2cir-dot" aria-hidden="true"></span>Ember & Ash</a>
<a href="#" class="w2cir-link">Coffee subscriptions</a>
</header>
<div class="w2cir-hero">
<div class="w2cir-text">
<p class="w2cir-kicker">Small batch roastery</p>
<h2 class="w2cir-title">Roasted on Monday, at your door by Wednesday.</h2>
<p class="w2cir-copy">Single origin beans roasted in twelve kilo batches, light enough to taste where they came from.</p>
<div class="w2cir-row"><a href="#" class="w2cir-cta">Choose a coffee</a><button type="button" class="w2cir-replay" data-replay="">
<svg viewBox="0 0 20 20" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 10a6 6 0 1 0 1.8-4.3" /><path d="M4 3.5v3.2h3.2" /></svg>
Replay intro
</button></div>
</div>
<div class="w2cir-pics">
<img class="w2cir-a" src="https://images.pexels.com/photos/894695/pexels-photo-894695.jpeg?auto=compress&cs=tinysrgb&w=1200" alt="Freshly roasted coffee beans turning in the drum of a large roaster" width="1200" height="800" />
<img class="w2cir-b" src="https://images.pexels.com/photos/14848712/pexels-photo-14848712.jpeg?auto=compress&cs=tinysrgb&w=800" alt="Close view of dark roasted coffee beans filling a container" width="800" height="533" />
</div>
</div>
</div>
<div class="w2cir-cover" data-cover="" aria-hidden="true">
<span class="w2cir-disc"></span>
<div class="w2cir-mid">
<span class="w2cir-bean"><span></span></span>
<p class="w2cir-pct"><span data-num="">0</span>%</p>
<p class="w2cir-note">Roasting the page</p>
</div>
</div>
<p class="w2cir-sr" data-live="" aria-live="polite"></p>
</section>
<style>
/* Change these: colours of the cover and the page. */
.w2cir { --w2cir-espresso: #251913; --w2cir-crema: #d9a66b; --w2cir-milk: #f4ece2; height: 600px; background: var(--w2cir-milk); color: #241812; font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif; }
.w2cir-page { height: 100%; display: flex; flex-direction: column; padding: 0 clamp(16px, 4vw, 48px); }
.w2cir-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 72px; }
.w2cir-brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; font-weight: 700; font-size: 17px; text-decoration: none; }
.w2cir-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--w2cir-espresso); }
.w2cir-link { display: inline-flex; align-items: center; min-height: 40px; color: #7a4a22; font-size: 14px; font-weight: 600; text-underline-offset: 4px; }
.w2cir-hero { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: clamp(20px, 4vw, 56px); align-items: center; min-height: 0; padding-bottom: 24px; }
.w2cir-kicker { margin: 0; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: #7a4a22; }
.w2cir-title { margin: 12px 0 0; font-size: clamp(30px, 4.4vw, 54px); line-height: 1.04; letter-spacing: -.03em; font-weight: 700; }
.w2cir-copy { margin: 16px 0 0; font-size: 16px; line-height: 1.6; color: #5b4637; max-width: 28rem; }
.w2cir-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.w2cir-cta { display: inline-flex; align-items: center; min-height: 44px; padding: 0 22px; border-radius: 999px; background: var(--w2cir-espresso); color: var(--w2cir-milk); font-size: 14px; font-weight: 600; text-decoration: none; }
.w2cir-replay { border: 1px solid #d6c3ad; background: transparent; color: #241812; }
.w2cir-pics { position: relative; height: 100%; max-height: 430px; }
.w2cir-pics img { position: absolute; object-fit: cover; display: block; }
.w2cir-a { top: 0; left: 0; width: 78%; height: 100%; border-radius: 220px 220px 8px 8px; transform: scale(.94); transition: transform 1.2s cubic-bezier(.2,.75,.15,1) .35s; }
.w2cir-b { right: 0; bottom: 30px; width: 40%; aspect-ratio: 1; height: auto; border-radius: 50%; border: 6px solid var(--w2cir-milk); transform: scale(.7); transition: transform 1.2s cubic-bezier(.3,1.3,.5,1) .5s; }
.w2cir.is-out .w2cir-a, .w2cir.is-out .w2cir-b { transform: none; }
.w2cir-cover { position: absolute; inset: 0; z-index: 2; overflow: hidden; }
.w2cir-disc { --w2cir-d: max(300%, 1500px); position: absolute; left: calc(clamp(16px, 4vw, 48px) + 7px); top: 36px; width: var(--w2cir-d); height: auto; aspect-ratio: 1; margin-left: calc(var(--w2cir-d) / -2); margin-top: calc(var(--w2cir-d) / -2); border-radius: 50%; background: var(--w2cir-espresso); transition: transform .75s cubic-bezier(.5,0,.85,.35); }
.w2cir.is-out .w2cir-disc { transform: scale(0); }
.w2cir-mid { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--w2cir-milk); transition: opacity .25s ease; }
.w2cir.is-out .w2cir-mid { opacity: 0; }
.w2cir-bean { position: relative; width: 30px; height: 42px; border-radius: 50%; background: var(--w2cir-crema); animation: w2cir-turn 2.4s cubic-bezier(.6,0,.4,1) infinite; }
.w2cir-bean span { position: absolute; left: 50%; top: 6px; bottom: 6px; width: 3px; margin-left: -1.5px; border-radius: 3px; background: var(--w2cir-espresso); transform: rotate(8deg); }
@keyframes w2cir-turn { 0%, 20% { transform: rotate(0deg); } 50%, 70% { transform: rotate(180deg); } 100% { transform: rotate(360deg); } }
.w2cir-pct { margin: 10px 0 0; font-size: clamp(44px, 7vw, 76px); font-weight: 300; line-height: 1; font-variant-numeric: tabular-nums; }
.w2cir-note { margin: 0; font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: var(--w2cir-crema); }
@media (max-width: 767px) {
.w2cir-link { font-size: 13px; }
.w2cir-hero { grid-template-columns: 1fr; align-content: start; gap: 18px; }
.w2cir-pics { height: 170px; order: -1; }
.w2cir-a { width: 100%; border-radius: 120px 120px 8px 8px; }
.w2cir-b { display: none; }
.w2cir-copy { font-size: 15px; margin-top: 12px; }
}
.w2cir { position: relative; overflow: hidden; }
.w2cir-cover[hidden] { display: none; }
.w2cir.is-snap, .w2cir.is-snap * { transition: none !important; }
.w2cir[data-paused] * { animation-play-state: paused !important; }
.w2cir-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.w2cir-replay { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px; font: 600 13px/1 ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
.w2cir-replay:focus-visible, .w2cir a:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
.w2cir *, .w2cir *::before, .w2cir *::after { animation: none !important; transition-duration: 0s !important; transition-delay: 0s !important; }
.w2cir .w2cir-cover { transition: opacity .45s ease !important; }
.w2cir.is-out .w2cir-cover { opacity: 0; }
.w2cir-cover *:not([data-bar]), .w2cir-page * { transform: none !important; opacity: 1; }
}
</style>
<script>
(function () {
/* Change these: shortest time the cover shows (ms), longest it may wait for images (ms), exit length (ms). */
var MIN = 800, CAP = 1400, EXIT = 800;
/* On a real page: give .w2cir-cover position: fixed; inset: 0 and put data-page on your <main>. */
var root = document.querySelector(".w2cir");
if (!root) return;
var page = root.querySelector("[data-page]"), cover = root.querySelector("[data-cover]");
var live = root.querySelector("[data-live]"), again = root.querySelector("[data-replay]");
var nums = root.querySelectorAll("[data-num]"), bars = root.querySelectorAll("[data-bar]"), ticks = root.querySelectorAll("[data-tick]");
var rm = matchMedia("(prefers-reduced-motion: reduce)"), run = 0, frame = 0, seen = true, step = null, timer = 0;
function draw(v) {
var t = String(Math.round(v * 100));
nums.forEach(function (n) { n.textContent = t; });
bars.forEach(function (b) { b.style.transform = "scaleX(" + v + ")"; });
}
function start(refocus) {
var id = ++run, t0 = performance.now(), imgs = page.querySelectorAll("img"), total = imgs.length, done = 0, shown = 0;
cancelAnimationFrame(frame); clearTimeout(timer);
root.classList.add("is-snap"); root.classList.remove("is-out");
cover.hidden = false; void root.offsetWidth; root.classList.remove("is-snap");
page.inert = true; page.setAttribute("aria-busy", "true"); live.textContent = "Loading";
ticks.forEach(function (k) { k.classList.remove("is-on"); });
/* Real progress: one step per image that fires load or error. */
imgs.forEach(function (img, i) {
function hit() { if (id !== run) return; done++; if (ticks[i]) ticks[i].classList.add("is-on"); }
if (img.complete) hit(); else { img.addEventListener("load", hit, { once: true }); img.addEventListener("error", hit, { once: true }); }
});
step = function (now) {
var real = total ? done / total : 1, t = now - t0;
if (t > CAP) real = 1;
shown += (real - shown) * (rm.matches ? 1 : 0.2);
if (real - shown < 0.004) shown = real;
draw(shown);
if (shown === 1 && t >= MIN) {
step = null; frame = 0;
root.classList.add("is-out"); live.textContent = "Page ready";
page.inert = false; page.removeAttribute("aria-busy");
timer = setTimeout(function () { cover.hidden = true; if (refocus) again.focus(); }, rm.matches ? 500 : EXIT);
return;
}
frame = seen ? requestAnimationFrame(step) : 0;
};
frame = requestAnimationFrame(step);
}
/* Off screen: stop the frame loop and pause CSS loops. */
new IntersectionObserver(function (e) {
seen = e[0].isIntersecting;
root.toggleAttribute("data-paused", !seen);
if (seen && step && !frame) frame = requestAnimationFrame(step);
}).observe(root);
again.addEventListener("click", function () { start(true); });
start(false);
})();
</script>
With reduced motion: The bean holds still and the dark disc fades out in place instead of shrinking.
Running cost: One large disc scales once and a small bean turns on a CSS loop that is paused off screen.
- Recolour the disc, the bean and the page with `--w2cir-espresso`, `--w2cir-crema` and `--w2cir-milk`.
- Move where the disc lands by changing the `left` and `top` of `.w2cir-disc` to the centre of your own logo mark.
- Keep `--w2cir-d` large enough that the disc, centred on the logo, still reaches the far corner of the box.
Forest Curved Curtain Preloader
A deep green curtain names a cabin rental and shows a progress line filling as the hero photo and cabin card load. When they finish, the whole curtain lifts away with a soft curved hem trailing below it, the meadow photo drifts up into place and the headline and card follow. Good for stays, retreats and outdoor brands.
<section class="w2lft">
<div class="w2lft-page" data-page="" aria-busy="true">
<img class="w2lft-bg" src="https://images.pexels.com/photos/5865768/pexels-photo-5865768.jpeg?auto=compress&cs=tinysrgb&w=1600" alt="Wooden cabin on a green meadow below a pine forest with low mist on the hills" width="1600" height="1067" />
<div class="w2lft-shade"></div>
<header class="w2lft-nav">
<a href="#" class="w2lft-brand">Pinewood Hollow</a>
<a href="#" class="w2lft-book">Check dates</a>
</header>
<div class="w2lft-body">
<div class="w2lft-text">
<h2 class="w2lft-title">Six cabins at the end of a gravel road.</h2>
<p class="w2lft-copy">Wood stoves, no televisions and a lake a short walk through the trees.</p>
<button type="button" class="w2lft-replay" data-replay="">
<svg viewBox="0 0 20 20" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 10a6 6 0 1 0 1.8-4.3" /><path d="M4 3.5v3.2h3.2" /></svg>
Replay intro
</button>
</div>
<figure class="w2lft-card">
<img src="https://images.pexels.com/photos/29277697/pexels-photo-29277697.jpeg?auto=compress&cs=tinysrgb&w=800" alt="Small wooden cabin among tall pines with rocky mountain peaks behind" width="800" height="533" />
<figcaption><strong>Cabin four</strong> Sleeps two, closest to the ridge path</figcaption>
</figure>
</div>
</div>
<div class="w2lft-cover" data-cover="" aria-hidden="true">
<span class="w2lft-curve"></span>
<p class="w2lft-word">Pinewood Hollow</p>
<div class="w2lft-foot">
<span>Fetching the view</span><span><span data-num="">0</span>%</span>
</div>
<span class="w2lft-track"><span data-bar=""></span></span>
</div>
<p class="w2lft-sr" data-live="" aria-live="polite"></p>
</section>
<style>
/* Change these: colours of the cover and the page. */
.w2lft { --w2lft-forest: #1d3a2c; --w2lft-moss: #b9c9a3; --w2lft-cream: #f4f1e8; height: 600px; background: var(--w2lft-forest); color: var(--w2lft-cream); font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif; }
.w2lft-page { position: relative; height: 100%; display: flex; flex-direction: column; padding: 0 clamp(16px, 4vw, 48px) clamp(18px, 4vw, 44px); }
.w2lft-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: translateY(40px) scale(1.08); transition: transform 1.5s cubic-bezier(.2,.75,.15,1) .15s; }
.w2lft.is-out .w2lft-bg { transform: none; }
.w2lft-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(16,30,22,.55), rgba(16,30,22,.1) 35%, rgba(16,30,22,.78)); }
.w2lft-nav, .w2lft-body { position: relative; }
.w2lft-nav { display: flex; align-items: center; justify-content: space-between; height: 76px; }
.w2lft-brand { color: inherit; font-weight: 700; letter-spacing: .04em; text-decoration: none; }
.w2lft-book { display: inline-flex; align-items: center; min-height: 42px; padding: 0 18px; border-radius: 999px; background: var(--w2lft-cream); color: var(--w2lft-forest); font-size: 14px; font-weight: 600; text-decoration: none; }
.w2lft-body { flex: 1; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.w2lft-text { max-width: 34rem; transform: translateY(30px); opacity: .001; transition: transform 1s cubic-bezier(.2,.75,.15,1) .35s, opacity .7s ease .35s; }
.w2lft.is-out .w2lft-text { transform: none; opacity: 1; }
.w2lft-title { margin: 0; font-family: ui-serif, Georgia, 'Times New Roman', serif; font-size: clamp(32px, 5vw, 64px); line-height: 1.03; font-weight: 400; }
.w2lft-copy { margin: 14px 0 20px; font-size: 16px; line-height: 1.6; color: #e1e6d8; }
.w2lft-replay { border: 1px solid rgba(244,241,232,.55); background: rgba(16,30,22,.35); color: var(--w2lft-cream); }
.w2lft-card { margin: 0; width: 240px; flex: none; background: var(--w2lft-cream); color: #1f2b22; padding: 8px 8px 12px; border-radius: 6px; box-shadow: 0 24px 50px -20px rgba(0,0,0,.55); transform: translateY(40px); opacity: .001; transition: transform 1s cubic-bezier(.2,.75,.15,1) .5s, opacity .7s ease .5s; }
.w2lft.is-out .w2lft-card { transform: rotate(-2deg); opacity: 1; }
.w2lft-card img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 3px; }
.w2lft-card figcaption { margin: 10px 4px 0; font-size: 13px; line-height: 1.45; color: #3d4a40; }
.w2lft-card strong { display: block; color: #1f2b22; font-size: 14px; }
.w2lft-cover { position: absolute; inset: 0; z-index: 2; background: var(--w2lft-forest); display: flex; flex-direction: column; justify-content: center; align-items: center; transition: transform 1s cubic-bezier(.76,0,.24,1); }
.w2lft.is-out .w2lft-cover { transform: translateY(calc(-100% - 160px)); }
.w2lft-curve { position: absolute; top: calc(100% - 1px); left: -25%; width: 150%; height: 150px; border-radius: 0 0 50% 50%; background: var(--w2lft-forest); }
.w2lft-word { margin: 0; font-family: ui-serif, Georgia, 'Times New Roman', serif; font-size: clamp(40px, 8vw, 100px); color: var(--w2lft-cream); letter-spacing: -.01em; text-align: center; line-height: 1.05; padding: 0 16px; }
.w2lft-foot { position: absolute; left: clamp(16px, 4vw, 48px); right: clamp(16px, 4vw, 48px); bottom: 48px; display: flex; justify-content: space-between; font-size: 14px; color: var(--w2lft-moss); font-variant-numeric: tabular-nums; }
.w2lft-track { position: absolute; left: clamp(16px, 4vw, 48px); right: clamp(16px, 4vw, 48px); bottom: 34px; height: 2px; background: rgba(185,201,163,.2); }
.w2lft-track span { display: block; height: 100%; background: var(--w2lft-moss); transform: scaleX(0); transform-origin: left; }
@media (max-width: 767px) {
.w2lft-body { flex-direction: column; align-items: stretch; justify-content: flex-end; }
.w2lft-card { display: none; }
.w2lft-copy { font-size: 15px; }
}
.w2lft { position: relative; overflow: hidden; }
.w2lft-cover[hidden] { display: none; }
.w2lft.is-snap, .w2lft.is-snap * { transition: none !important; }
.w2lft[data-paused] * { animation-play-state: paused !important; }
.w2lft-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.w2lft-replay { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px; font: 600 13px/1 ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
.w2lft-replay:focus-visible, .w2lft a:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
.w2lft *, .w2lft *::before, .w2lft *::after { animation: none !important; transition-duration: 0s !important; transition-delay: 0s !important; }
.w2lft .w2lft-cover { transition: opacity .45s ease !important; }
.w2lft.is-out .w2lft-cover { opacity: 0; }
.w2lft-cover *:not([data-bar]), .w2lft-page * { transform: none !important; opacity: 1; }
}
</style>
<script>
(function () {
/* Change these: shortest time the cover shows (ms), longest it may wait for images (ms), exit length (ms). */
var MIN = 900, CAP = 1500, EXIT = 1100;
/* On a real page: give .w2lft-cover position: fixed; inset: 0 and put data-page on your <main>. */
var root = document.querySelector(".w2lft");
if (!root) return;
var page = root.querySelector("[data-page]"), cover = root.querySelector("[data-cover]");
var live = root.querySelector("[data-live]"), again = root.querySelector("[data-replay]");
var nums = root.querySelectorAll("[data-num]"), bars = root.querySelectorAll("[data-bar]"), ticks = root.querySelectorAll("[data-tick]");
var rm = matchMedia("(prefers-reduced-motion: reduce)"), run = 0, frame = 0, seen = true, step = null, timer = 0;
function draw(v) {
var t = String(Math.round(v * 100));
nums.forEach(function (n) { n.textContent = t; });
bars.forEach(function (b) { b.style.transform = "scaleX(" + v + ")"; });
}
function start(refocus) {
var id = ++run, t0 = performance.now(), imgs = page.querySelectorAll("img"), total = imgs.length, done = 0, shown = 0;
cancelAnimationFrame(frame); clearTimeout(timer);
root.classList.add("is-snap"); root.classList.remove("is-out");
cover.hidden = false; void root.offsetWidth; root.classList.remove("is-snap");
page.inert = true; page.setAttribute("aria-busy", "true"); live.textContent = "Loading";
ticks.forEach(function (k) { k.classList.remove("is-on"); });
/* Real progress: one step per image that fires load or error. */
imgs.forEach(function (img, i) {
function hit() { if (id !== run) return; done++; if (ticks[i]) ticks[i].classList.add("is-on"); }
if (img.complete) hit(); else { img.addEventListener("load", hit, { once: true }); img.addEventListener("error", hit, { once: true }); }
});
step = function (now) {
var real = total ? done / total : 1, t = now - t0;
if (t > CAP) real = 1;
shown += (real - shown) * (rm.matches ? 1 : 0.2);
if (real - shown < 0.004) shown = real;
draw(shown);
if (shown === 1 && t >= MIN) {
step = null; frame = 0;
root.classList.add("is-out"); live.textContent = "Page ready";
page.inert = false; page.removeAttribute("aria-busy");
timer = setTimeout(function () { cover.hidden = true; if (refocus) again.focus(); }, rm.matches ? 500 : EXIT);
return;
}
frame = seen ? requestAnimationFrame(step) : 0;
};
frame = requestAnimationFrame(step);
}
/* Off screen: stop the frame loop and pause CSS loops. */
new IntersectionObserver(function (e) {
seen = e[0].isIntersecting;
root.toggleAttribute("data-paused", !seen);
if (seen && step && !frame) frame = requestAnimationFrame(step);
}).observe(root);
again.addEventListener("click", function () { start(true); });
start(false);
})();
</script>
With reduced motion: The curtain does not lift; it fades out over the meadow photo, which is already in its final place.
Running cost: One layer and its curved hem lift together by transform, so the hem costs nothing extra to move.
- Recolour the curtain, the progress line and the light text with `--w2lft-forest`, `--w2lft-moss` and `--w2lft-cream`.
- Make the hem deeper or flatter by changing the `150px` height of `.w2lft-curve`, and keep the lift distance in `.w2lft.is-out .w2lft-cover` at least that much larger.
- Change the status words in `.w2lft-foot` to suit the brand.
Graphite Shutter Preloader
Six graphite slats cover an architecture practice's homepage while its two photographs load, with a thin rule and a large percentage counting the images that have arrived. When the last one lands, alternate slats slide up and down in a quick ripple and the photos settle from a slight zoom. Suits portfolio sites that lead with large pictures.
<section class="w2shu">
<div class="w2shu-page" data-page="" aria-busy="true">
<header class="w2shu-nav">
<a href="#" class="w2shu-brand">Ostrander Hale</a>
<nav aria-label="Main"><ul><li><a href="#">Houses</a></li><li><a href="#">Practice</a></li><li><a href="#">Contact</a></li></ul></nav>
</header>
<div class="w2shu-hero">
<div class="w2shu-text">
<p class="w2shu-kicker">Architects, Wellington Road</p>
<h2 class="w2shu-title">Houses drawn around the light they get.</h2>
<p class="w2shu-copy">We design new homes and quiet extensions, from the first site visit to the last coat of limewash.</p>
<div class="w2shu-row"><a href="#" class="w2shu-cta">See recent houses</a><button type="button" class="w2shu-replay" data-replay="">
<svg viewBox="0 0 20 20" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 10a6 6 0 1 0 1.8-4.3" /><path d="M4 3.5v3.2h3.2" /></svg>
Replay intro
</button></div>
</div>
<div class="w2shu-pics">
<img class="w2shu-a" src="https://images.pexels.com/photos/18273285/pexels-photo-18273285.jpeg?auto=compress&cs=tinysrgb&w=1200" alt="Two-storey modern house with dark cladding and white render behind young trees" width="1200" height="800" />
<img class="w2shu-b" src="https://images.pexels.com/photos/7031622/pexels-photo-7031622.jpeg?auto=compress&cs=tinysrgb&w=1200" alt="Open plan room with a concrete floor and wide windows facing a lake" width="1200" height="800" />
</div>
</div>
</div>
<div class="w2shu-cover" data-cover="" aria-hidden="true">
<span class="w2shu-slat"></span><span class="w2shu-slat"></span><span class="w2shu-slat"></span><span class="w2shu-slat"></span><span class="w2shu-slat"></span><span class="w2shu-slat"></span>
<div class="w2shu-mark">
<p class="w2shu-name">Ostrander Hale</p>
<p class="w2shu-count"><span data-num="">0</span>%</p>
<span class="w2shu-line"><span data-bar=""></span></span>
</div>
</div>
<p class="w2shu-sr" data-live="" aria-live="polite"></p>
</section>
<style>
/* Change these: colours of the cover and the page. */
.w2shu { --w2shu-cover: #26282b; --w2shu-page: #eceae6; --w2shu-ink: #1d1f22; height: 600px; background: var(--w2shu-page); color: var(--w2shu-ink); font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif; }
.w2shu-page { height: 100%; display: flex; flex-direction: column; padding: 0 clamp(16px, 4vw, 48px); }
.w2shu-nav { display: flex; align-items: center; justify-content: space-between; height: 72px; border-bottom: 1px solid #d3d0ca; }
.w2shu-brand { color: inherit; font-weight: 700; letter-spacing: .02em; text-decoration: none; }
.w2shu-nav ul { display: flex; gap: 28px; margin: 0; padding: 0; list-style: none; }
.w2shu-nav ul a { color: #4a4d52; font-size: 14px; text-decoration: none; }
.w2shu-hero { flex: 1; display: grid; grid-template-columns: 1fr 1.15fr; gap: clamp(20px, 4vw, 56px); align-items: center; padding: 28px 0; min-height: 0; }
.w2shu-kicker { margin: 0; font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: #5d6066; }
.w2shu-title { margin: 16px 0 0; font-size: clamp(30px, 4.4vw, 54px); line-height: 1.04; letter-spacing: -.03em; font-weight: 600; }
.w2shu-copy { margin: 18px 0 0; max-width: 30rem; font-size: 16px; line-height: 1.6; color: #4a4d52; }
.w2shu-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.w2shu-cta { display: inline-flex; align-items: center; min-height: 44px; padding: 0 22px; background: var(--w2shu-ink); color: #f4f2ee; border-radius: 2px; font-size: 14px; font-weight: 600; text-decoration: none; }
.w2shu-replay { border: 1px solid #b9b5ae; background: transparent; color: var(--w2shu-ink); }
.w2shu-pics { position: relative; height: 100%; max-height: 430px; }
.w2shu-pics img { position: absolute; object-fit: cover; display: block; box-shadow: 0 24px 50px -24px rgba(20,20,22,.45); }
.w2shu-a { inset: 0 18% 14% 0; width: 82%; height: 86%; }
.w2shu-b { right: 0; bottom: 0; width: 44%; height: 42%; border: 6px solid var(--w2shu-page); }
.w2shu-pics img { transform: scale(1.06); transition: transform 1.4s cubic-bezier(.2,.7,.2,1) .3s; }
.w2shu.is-out .w2shu-pics img { transform: none; }
.w2shu-cover { position: absolute; inset: 0; display: flex; z-index: 2; }
.w2shu-slat { flex: 1; height: 100%; background: var(--w2shu-cover); transition: transform .7s cubic-bezier(.7,0,.25,1); }
.w2shu-slat + .w2shu-slat { box-shadow: inset 1px 0 rgba(255,255,255,.04); }
.w2shu-slat:nth-child(2) { transition-delay: .05s; } .w2shu-slat:nth-child(3) { transition-delay: .1s; }
.w2shu-slat:nth-child(4) { transition-delay: .15s; } .w2shu-slat:nth-child(5) { transition-delay: .2s; } .w2shu-slat:nth-child(6) { transition-delay: .25s; }
.w2shu.is-out .w2shu-slat:nth-child(odd) { transform: translateY(-101%); }
.w2shu.is-out .w2shu-slat:nth-child(even) { transform: translateY(101%); }
.w2shu-mark { position: absolute; left: clamp(16px, 4vw, 48px); right: clamp(16px, 4vw, 48px); bottom: 40px; color: #e9e6e0; transition: opacity .25s ease, transform .4s ease; }
.w2shu.is-out .w2shu-mark { opacity: 0; transform: translateY(-12px); }
.w2shu-name { margin: 0; font-size: 13px; letter-spacing: .3em; text-transform: uppercase; color: #a9a6a0; }
.w2shu-count { margin: 6px 0 14px; font-size: clamp(56px, 9vw, 112px); font-weight: 300; line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.w2shu-line { display: block; height: 1px; background: rgba(233,230,224,.18); }
.w2shu-line span { display: block; height: 100%; background: #e9e6e0; transform: scaleX(0); transform-origin: left; }
@media (max-width: 767px) {
.w2shu-nav ul li:not(:last-child) { display: none; }
.w2shu-hero { grid-template-columns: 1fr; align-content: start; gap: 22px; padding-top: 22px; }
.w2shu-pics { height: 170px; }
.w2shu-b { display: none; }
.w2shu-a { inset: 0; width: 100%; height: 100%; }
.w2shu-copy { font-size: 15px; }
}
.w2shu { position: relative; overflow: hidden; }
.w2shu-cover[hidden] { display: none; }
.w2shu.is-snap, .w2shu.is-snap * { transition: none !important; }
.w2shu[data-paused] * { animation-play-state: paused !important; }
.w2shu-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.w2shu-replay { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px; font: 600 13px/1 ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
.w2shu-replay:focus-visible, .w2shu a:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
.w2shu *, .w2shu *::before, .w2shu *::after { animation: none !important; transition-duration: 0s !important; transition-delay: 0s !important; }
.w2shu .w2shu-cover { transition: opacity .45s ease !important; }
.w2shu.is-out .w2shu-cover { opacity: 0; }
.w2shu-cover *:not([data-bar]), .w2shu-page * { transform: none !important; opacity: 1; }
}
</style>
<script>
(function () {
/* Change these: shortest time the cover shows (ms), longest it may wait for images (ms), exit length (ms). */
var MIN = 900, CAP = 1500, EXIT = 1000;
/* On a real page: give .w2shu-cover position: fixed; inset: 0 and put data-page on your <main>. */
var root = document.querySelector(".w2shu");
if (!root) return;
var page = root.querySelector("[data-page]"), cover = root.querySelector("[data-cover]");
var live = root.querySelector("[data-live]"), again = root.querySelector("[data-replay]");
var nums = root.querySelectorAll("[data-num]"), bars = root.querySelectorAll("[data-bar]"), ticks = root.querySelectorAll("[data-tick]");
var rm = matchMedia("(prefers-reduced-motion: reduce)"), run = 0, frame = 0, seen = true, step = null, timer = 0;
function draw(v) {
var t = String(Math.round(v * 100));
nums.forEach(function (n) { n.textContent = t; });
bars.forEach(function (b) { b.style.transform = "scaleX(" + v + ")"; });
}
function start(refocus) {
var id = ++run, t0 = performance.now(), imgs = page.querySelectorAll("img"), total = imgs.length, done = 0, shown = 0;
cancelAnimationFrame(frame); clearTimeout(timer);
root.classList.add("is-snap"); root.classList.remove("is-out");
cover.hidden = false; void root.offsetWidth; root.classList.remove("is-snap");
page.inert = true; page.setAttribute("aria-busy", "true"); live.textContent = "Loading";
ticks.forEach(function (k) { k.classList.remove("is-on"); });
/* Real progress: one step per image that fires load or error. */
imgs.forEach(function (img, i) {
function hit() { if (id !== run) return; done++; if (ticks[i]) ticks[i].classList.add("is-on"); }
if (img.complete) hit(); else { img.addEventListener("load", hit, { once: true }); img.addEventListener("error", hit, { once: true }); }
});
step = function (now) {
var real = total ? done / total : 1, t = now - t0;
if (t > CAP) real = 1;
shown += (real - shown) * (rm.matches ? 1 : 0.2);
if (real - shown < 0.004) shown = real;
draw(shown);
if (shown === 1 && t >= MIN) {
step = null; frame = 0;
root.classList.add("is-out"); live.textContent = "Page ready";
page.inert = false; page.removeAttribute("aria-busy");
timer = setTimeout(function () { cover.hidden = true; if (refocus) again.focus(); }, rm.matches ? 500 : EXIT);
return;
}
frame = seen ? requestAnimationFrame(step) : 0;
};
frame = requestAnimationFrame(step);
}
/* Off screen: stop the frame loop and pause CSS loops. */
new IntersectionObserver(function (e) {
seen = e[0].isIntersecting;
root.toggleAttribute("data-paused", !seen);
if (seen && step && !frame) frame = requestAnimationFrame(step);
}).observe(root);
again.addEventListener("click", function () { start(true); });
start(false);
})();
</script>
With reduced motion: The graphite cover stays still and simply fades away once the photographs are in.
Running cost: Six flat layers move by transform once, and the progress loop only runs while images are still loading.
- Change the cover and page colours through `--w2shu-cover` and `--w2shu-page` at the top of the CSS.
- Add or remove `.w2shu-slat` spans to get more or fewer shutters; the flex row shares the width between them.
- Shorten the ripple by lowering the `transition-delay` steps on the `nth-child` rules.
Linen Mat Aperture Preloader
A cream mat, like the card around a framed print, covers a linen shop's page with a small window cut in the middle, so the fabric photo can be seen arriving through it. When the images are in, the four sides of the mat slide out to the edges and the photo eases back to full size. Fits textiles, framing and craft shops.
<section class="w2mat">
<div class="w2mat-page" data-page="" aria-busy="true">
<img class="w2mat-bg" src="https://images.pexels.com/photos/7232397/pexels-photo-7232397.jpeg?auto=compress&cs=tinysrgb&w=1600" alt="Close view of soft beige linen fabric gathered in loose folds" width="1600" height="900" />
<header class="w2mat-nav">
<a href="#" class="w2mat-brand">Weft & Fold</a>
<a href="#" class="w2mat-link">Shop bedding</a>
</header>
<div class="w2mat-panel">
<p class="w2mat-kicker">Stonewashed linen</p>
<h2 class="w2mat-title">Sheets that soften with every wash.</h2>
<div class="w2mat-row">
<img src="https://images.pexels.com/photos/11733651/pexels-photo-11733651.jpeg?auto=compress&cs=tinysrgb&w=600" alt="Stack of folded sage green linen napkins" width="600" height="400" />
<p>Sage, oat and chalk, cut and hemmed in a small mill.</p>
</div>
<button type="button" class="w2mat-replay" data-replay="">
<svg viewBox="0 0 20 20" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 10a6 6 0 1 0 1.8-4.3" /><path d="M4 3.5v3.2h3.2" /></svg>
Replay intro
</button>
</div>
</div>
<div class="w2mat-cover" data-cover="" aria-hidden="true">
<span class="w2mat-t"><span class="w2mat-name">Weft & Fold</span></span>
<span class="w2mat-b"><span class="w2mat-pct"><span data-num="">0</span>% woven</span></span>
<span class="w2mat-l"></span>
<span class="w2mat-r"></span>
<span class="w2mat-edge"></span>
</div>
<p class="w2mat-sr" data-live="" aria-live="polite"></p>
</section>
<style>
/* Change these: colours of the cover and the page. */
.w2mat { --w2mat-mat: #efe7da; --w2mat-ink: #2f2a22; --w2mat-shadow: rgba(60,48,30,.28); height: 600px; background: #d9cfbf; color: var(--w2mat-ink); font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif; }
.w2mat-page { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: space-between; padding: 0 clamp(16px, 4vw, 48px) clamp(16px, 4vw, 44px); }
.w2mat-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.12); transition: transform 1.6s cubic-bezier(.2,.75,.15,1); }
.w2mat.is-out .w2mat-bg { transform: none; }
.w2mat-nav, .w2mat-panel { position: relative; }
.w2mat-nav { display: flex; align-items: center; justify-content: space-between; height: 76px; }
.w2mat-brand { color: inherit; font-family: ui-serif, Georgia, 'Times New Roman', serif; font-size: 22px; text-decoration: none; }
.w2mat-link { display: inline-flex; align-items: center; min-height: 42px; padding: 0 18px; border-radius: 999px; background: var(--w2mat-ink); color: #f7f2ea; font-size: 14px; text-decoration: none; }
.w2mat-panel { max-width: 27rem; background: rgba(250,246,239,.94); padding: clamp(20px, 3vw, 30px); border-radius: 4px; box-shadow: 0 20px 50px -24px var(--w2mat-shadow); }
.w2mat-kicker { margin: 0; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: #6b5d48; }
.w2mat-title { margin: 10px 0 0; font-family: ui-serif, Georgia, 'Times New Roman', serif; font-size: clamp(28px, 3.6vw, 42px); line-height: 1.08; font-weight: 400; }
.w2mat-row { display: flex; gap: 14px; align-items: center; margin: 16px 0 18px; }
.w2mat-row img { width: 88px; height: 60px; object-fit: cover; border-radius: 2px; flex: none; }
.w2mat-row p { margin: 0; font-size: 15px; line-height: 1.5; color: #4f4637; }
.w2mat-replay { border: 1px solid #cdbfa8; background: transparent; color: var(--w2mat-ink); }
.w2mat-cover { position: absolute; inset: 0; z-index: 2; }
.w2mat-t, .w2mat-b, .w2mat-l, .w2mat-r { position: absolute; background: var(--w2mat-mat); transition: transform .9s cubic-bezier(.7,0,.2,1) .1s; }
.w2mat-t { top: 0; left: 0; right: 0; height: 34%; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 18px; }
.w2mat-b { bottom: 0; left: 0; right: 0; height: 34%; display: flex; align-items: flex-start; justify-content: center; padding-top: 18px; }
.w2mat-l { top: 33.9%; bottom: 33.9%; left: 0; width: 34%; }
.w2mat-r { top: 33.9%; bottom: 33.9%; right: 0; width: 34%; }
.w2mat-edge { position: absolute; top: 34%; bottom: 34%; left: 34%; right: 34%; box-shadow: inset 0 2px 10px var(--w2mat-shadow); transition: opacity .3s ease; }
.w2mat.is-out .w2mat-edge, .w2mat.is-out .w2mat-name, .w2mat.is-out .w2mat-pct { opacity: 0; }
.w2mat.is-out .w2mat-t { transform: translateY(-101%); }
.w2mat.is-out .w2mat-b { transform: translateY(101%); }
.w2mat.is-out .w2mat-l { transform: translateX(-101%); }
.w2mat.is-out .w2mat-r { transform: translateX(101%); }
.w2mat-name { font-family: ui-serif, Georgia, 'Times New Roman', serif; font-size: clamp(26px, 4vw, 40px); color: var(--w2mat-ink); transition: opacity .25s ease; }
.w2mat-pct { font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: #5f5340; font-variant-numeric: tabular-nums; transition: opacity .25s ease; }
@media (max-width: 767px) {
.w2mat-l, .w2mat-r { width: 18%; }
.w2mat-edge { left: 18%; right: 18%; }
.w2mat-row img { width: 72px; height: 50px; }
}
.w2mat { position: relative; overflow: hidden; }
.w2mat-cover[hidden] { display: none; }
.w2mat.is-snap, .w2mat.is-snap * { transition: none !important; }
.w2mat[data-paused] * { animation-play-state: paused !important; }
.w2mat-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.w2mat-replay { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px; font: 600 13px/1 ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
.w2mat-replay:focus-visible, .w2mat a:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
.w2mat *, .w2mat *::before, .w2mat *::after { animation: none !important; transition-duration: 0s !important; transition-delay: 0s !important; }
.w2mat .w2mat-cover { transition: opacity .45s ease !important; }
.w2mat.is-out .w2mat-cover { opacity: 0; }
.w2mat-cover *:not([data-bar]), .w2mat-page * { transform: none !important; opacity: 1; }
}
</style>
<script>
(function () {
/* Change these: shortest time the cover shows (ms), longest it may wait for images (ms), exit length (ms). */
var MIN = 1000, CAP = 1500, EXIT = 1000;
/* On a real page: give .w2mat-cover position: fixed; inset: 0 and put data-page on your <main>. */
var root = document.querySelector(".w2mat");
if (!root) return;
var page = root.querySelector("[data-page]"), cover = root.querySelector("[data-cover]");
var live = root.querySelector("[data-live]"), again = root.querySelector("[data-replay]");
var nums = root.querySelectorAll("[data-num]"), bars = root.querySelectorAll("[data-bar]"), ticks = root.querySelectorAll("[data-tick]");
var rm = matchMedia("(prefers-reduced-motion: reduce)"), run = 0, frame = 0, seen = true, step = null, timer = 0;
function draw(v) {
var t = String(Math.round(v * 100));
nums.forEach(function (n) { n.textContent = t; });
bars.forEach(function (b) { b.style.transform = "scaleX(" + v + ")"; });
}
function start(refocus) {
var id = ++run, t0 = performance.now(), imgs = page.querySelectorAll("img"), total = imgs.length, done = 0, shown = 0;
cancelAnimationFrame(frame); clearTimeout(timer);
root.classList.add("is-snap"); root.classList.remove("is-out");
cover.hidden = false; void root.offsetWidth; root.classList.remove("is-snap");
page.inert = true; page.setAttribute("aria-busy", "true"); live.textContent = "Loading";
ticks.forEach(function (k) { k.classList.remove("is-on"); });
/* Real progress: one step per image that fires load or error. */
imgs.forEach(function (img, i) {
function hit() { if (id !== run) return; done++; if (ticks[i]) ticks[i].classList.add("is-on"); }
if (img.complete) hit(); else { img.addEventListener("load", hit, { once: true }); img.addEventListener("error", hit, { once: true }); }
});
step = function (now) {
var real = total ? done / total : 1, t = now - t0;
if (t > CAP) real = 1;
shown += (real - shown) * (rm.matches ? 1 : 0.2);
if (real - shown < 0.004) shown = real;
draw(shown);
if (shown === 1 && t >= MIN) {
step = null; frame = 0;
root.classList.add("is-out"); live.textContent = "Page ready";
page.inert = false; page.removeAttribute("aria-busy");
timer = setTimeout(function () { cover.hidden = true; if (refocus) again.focus(); }, rm.matches ? 500 : EXIT);
return;
}
frame = seen ? requestAnimationFrame(step) : 0;
};
frame = requestAnimationFrame(step);
}
/* Off screen: stop the frame loop and pause CSS loops. */
new IntersectionObserver(function (e) {
seen = e[0].isIntersecting;
root.toggleAttribute("data-paused", !seen);
if (seen && step && !frame) frame = requestAnimationFrame(step);
}).observe(root);
again.addEventListener("click", function () { start(true); });
start(false);
})();
</script>
With reduced motion: The mat stays whole and fades away in one step, leaving the photo and panel in place.
Running cost: Four flat sides slide by transform and one photo scales; the window shadow is drawn once and only faded.
- Change the mat colour with `--w2mat-mat` and the inner shadow around the window with `--w2mat-shadow`.
- Make the window bigger or smaller by changing the `34%` sizes on the four sides and on `.w2mat-edge` together.
- Edit the shop name in `.w2mat-name` and the status words in `.w2mat-pct`.
Navy Split Halves Preloader
A navy cover is split at its middle, with the hotel's name sitting across the seam and a gold hairline growing along it as the room photos load. Then the halves part, one up and one down, the photo eases out of a zoom and the booking card rises. Good for hotels, guest houses and anything with a strong wordmark.
<section class="w2spl">
<div class="w2spl-page" data-page="" aria-busy="true">
<img class="w2spl-bg" src="https://images.pexels.com/photos/7507131/pexels-photo-7507131.jpeg?auto=compress&cs=tinysrgb&w=1600" alt="Hotel room with sheer white curtains drawn across a tall window in soft daylight" width="1600" height="1067" />
<div class="w2spl-shade"></div>
<header class="w2spl-nav">
<a href="#" class="w2spl-brand">The Calder Rooms</a>
<a href="#" class="w2spl-book">Book a room</a>
</header>
<div class="w2spl-card">
<p class="w2spl-kicker">Harbour Road, open all year</p>
<h2 class="w2spl-title">Twenty-two quiet rooms above the harbour.</h2>
<div class="w2spl-row">
<img class="w2spl-thumb" src="https://images.pexels.com/photos/11063185/pexels-photo-11063185.jpeg?auto=compress&cs=tinysrgb&w=600" alt="Black and white photo of a made bed beside a window with a framed print of trees" width="600" height="400" />
<p class="w2spl-copy">Linen sheets, a deep bath and breakfast served until eleven.</p>
</div>
<button type="button" class="w2spl-replay" data-replay="">
<svg viewBox="0 0 20 20" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 10a6 6 0 1 0 1.8-4.3" /><path d="M4 3.5v3.2h3.2" /></svg>
Replay intro
</button>
</div>
</div>
<div class="w2spl-cover" data-cover="" aria-hidden="true">
<div class="w2spl-half w2spl-top"><p class="w2spl-mark">Calder</p></div>
<div class="w2spl-half w2spl-bot"><p class="w2spl-mark">Calder</p></div>
<span class="w2spl-seam"><span data-bar=""></span></span>
<p class="w2spl-pct"><span data-num="">0</span>%</p>
</div>
<p class="w2spl-sr" data-live="" aria-live="polite"></p>
</section>
<style>
/* Change these: colours of the cover and the page. */
.w2spl { --w2spl-navy: #13203a; --w2spl-gold: #c8a96a; --w2spl-ivory: #f7f3ec; height: 600px; background: var(--w2spl-navy); color: var(--w2spl-ivory); font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif; }
.w2spl-page { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: space-between; padding: 0 clamp(16px, 4vw, 48px) clamp(16px, 4vw, 44px); }
.w2spl-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.1); transition: transform 1.8s cubic-bezier(.2,.7,.2,1) .2s; }
.w2spl.is-out .w2spl-bg { transform: none; }
.w2spl-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(14,24,44,.78), rgba(14,24,44,.15) 70%); }
.w2spl-nav, .w2spl-card { position: relative; }
.w2spl-nav { display: flex; align-items: center; justify-content: space-between; height: 76px; }
.w2spl-brand { color: inherit; font-family: ui-serif, Georgia, 'Times New Roman', serif; font-size: 20px; letter-spacing: .04em; text-decoration: none; }
.w2spl-book { display: inline-flex; align-items: center; min-height: 42px; padding: 0 18px; border-radius: 999px; background: var(--w2spl-ivory); color: var(--w2spl-navy); font-size: 14px; font-weight: 600; text-decoration: none; }
.w2spl-card { max-width: 30rem; background: var(--w2spl-ivory); color: var(--w2spl-navy); padding: clamp(20px, 3vw, 32px); border-radius: 4px; box-shadow: 0 30px 60px -30px rgba(0,0,0,.6); transform: translateY(24px); opacity: .001; transition: transform .9s cubic-bezier(.2,.75,.15,1) .45s, opacity .6s ease .45s; }
.w2spl.is-out .w2spl-card { transform: none; opacity: 1; }
.w2spl-kicker { margin: 0; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: #6d5a33; }
.w2spl-title { margin: 10px 0 0; font-family: ui-serif, Georgia, 'Times New Roman', serif; font-size: clamp(26px, 3.4vw, 40px); line-height: 1.1; font-weight: 400; }
.w2spl-row { display: flex; gap: 14px; align-items: center; margin: 16px 0 18px; }
.w2spl-thumb { width: 96px; height: 64px; object-fit: cover; border-radius: 2px; flex: none; }
.w2spl-copy { margin: 0; font-size: 15px; line-height: 1.55; color: #3c4658; }
.w2spl-replay { border: 1px solid #c9c2b4; background: transparent; color: var(--w2spl-navy); }
.w2spl-cover { position: absolute; inset: 0; z-index: 2; }
.w2spl-half { position: absolute; left: 0; right: 0; height: 50%; overflow: hidden; background: var(--w2spl-navy); transition: transform .7s cubic-bezier(.55,0,.85,.4) .1s; }
.w2spl-top { top: 0; } .w2spl-bot { bottom: 0; }
.w2spl.is-out .w2spl-top { transform: translateY(-101%); }
.w2spl.is-out .w2spl-bot { transform: translateY(101%); }
.w2spl-mark { position: absolute; left: 0; right: 0; margin: 0; height: 1em; line-height: 1; text-align: center; font-family: ui-serif, Georgia, 'Times New Roman', serif; font-size: clamp(80px, 17vw, 220px); letter-spacing: .02em; color: var(--w2spl-ivory); transition: opacity .3s ease .15s; }
.w2spl.is-out .w2spl-mark { opacity: 0; }
.w2spl-top .w2spl-mark { bottom: -.5em; } .w2spl-bot .w2spl-mark { top: -.5em; }
.w2spl-seam { position: absolute; left: 0; right: 0; top: 50%; height: 1px; transition: opacity .2s ease; }
.w2spl-seam span { display: block; height: 100%; background: var(--w2spl-gold); transform: scaleX(0); }
.w2spl.is-out .w2spl-seam, .w2spl.is-out .w2spl-pct { opacity: 0; }
.w2spl-pct { position: absolute; left: 0; right: 0; bottom: 36px; margin: 0; text-align: center; font-size: 13px; letter-spacing: .3em; color: var(--w2spl-gold); font-variant-numeric: tabular-nums; transition: opacity .2s ease; }
@media (max-width: 767px) {
.w2spl-thumb { width: 76px; height: 54px; }
.w2spl-shade { background: linear-gradient(0deg, rgba(14,24,44,.7), rgba(14,24,44,.2)); }
}
.w2spl { position: relative; overflow: hidden; }
.w2spl-cover[hidden] { display: none; }
.w2spl.is-snap, .w2spl.is-snap * { transition: none !important; }
.w2spl[data-paused] * { animation-play-state: paused !important; }
.w2spl-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.w2spl-replay { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px; font: 600 13px/1 ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
.w2spl-replay:focus-visible, .w2spl a:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
.w2spl *, .w2spl *::before, .w2spl *::after { animation: none !important; transition-duration: 0s !important; transition-delay: 0s !important; }
.w2spl .w2spl-cover { transition: opacity .45s ease !important; }
.w2spl.is-out .w2spl-cover { opacity: 0; }
.w2spl-cover *:not([data-bar]), .w2spl-page * { transform: none !important; opacity: 1; }
}
</style>
<script>
(function () {
/* Change these: shortest time the cover shows (ms), longest it may wait for images (ms), exit length (ms). */
var MIN = 800, CAP = 1400, EXIT = 850;
/* On a real page: give .w2spl-cover position: fixed; inset: 0 and put data-page on your <main>. */
var root = document.querySelector(".w2spl");
if (!root) return;
var page = root.querySelector("[data-page]"), cover = root.querySelector("[data-cover]");
var live = root.querySelector("[data-live]"), again = root.querySelector("[data-replay]");
var nums = root.querySelectorAll("[data-num]"), bars = root.querySelectorAll("[data-bar]"), ticks = root.querySelectorAll("[data-tick]");
var rm = matchMedia("(prefers-reduced-motion: reduce)"), run = 0, frame = 0, seen = true, step = null, timer = 0;
function draw(v) {
var t = String(Math.round(v * 100));
nums.forEach(function (n) { n.textContent = t; });
bars.forEach(function (b) { b.style.transform = "scaleX(" + v + ")"; });
}
function start(refocus) {
var id = ++run, t0 = performance.now(), imgs = page.querySelectorAll("img"), total = imgs.length, done = 0, shown = 0;
cancelAnimationFrame(frame); clearTimeout(timer);
root.classList.add("is-snap"); root.classList.remove("is-out");
cover.hidden = false; void root.offsetWidth; root.classList.remove("is-snap");
page.inert = true; page.setAttribute("aria-busy", "true"); live.textContent = "Loading";
ticks.forEach(function (k) { k.classList.remove("is-on"); });
/* Real progress: one step per image that fires load or error. */
imgs.forEach(function (img, i) {
function hit() { if (id !== run) return; done++; if (ticks[i]) ticks[i].classList.add("is-on"); }
if (img.complete) hit(); else { img.addEventListener("load", hit, { once: true }); img.addEventListener("error", hit, { once: true }); }
});
step = function (now) {
var real = total ? done / total : 1, t = now - t0;
if (t > CAP) real = 1;
shown += (real - shown) * (rm.matches ? 1 : 0.2);
if (real - shown < 0.004) shown = real;
draw(shown);
if (shown === 1 && t >= MIN) {
step = null; frame = 0;
root.classList.add("is-out"); live.textContent = "Page ready";
page.inert = false; page.removeAttribute("aria-busy");
timer = setTimeout(function () { cover.hidden = true; if (refocus) again.focus(); }, rm.matches ? 500 : EXIT);
return;
}
frame = seen ? requestAnimationFrame(step) : 0;
};
frame = requestAnimationFrame(step);
}
/* Off screen: stop the frame loop and pause CSS loops. */
new IntersectionObserver(function (e) {
seen = e[0].isIntersecting;
root.toggleAttribute("data-paused", !seen);
if (seen && step && !frame) frame = requestAnimationFrame(step);
}).observe(root);
again.addEventListener("click", function () { start(true); });
start(false);
})();
</script>
With reduced motion: The halves never part; the navy cover fades out over the finished photo and card.
Running cost: Two half-height layers and one photo move by transform, and the hairline is a single scaled line.
- Change the cover, seam and card colours through `--w2spl-navy`, `--w2spl-gold` and `--w2spl-ivory`.
- Swap the word inside both `.w2spl-mark` paragraphs; they must match so the two halves line up into one name.
- Size the split name with the `clamp()` on `.w2spl-mark`; keep it short enough to fit one line on a phone.
Paper Counter Handover Preloader
The whole cover is the studio's paper colour with one oversized number counting the page's photographs. On load it slides up out of its mask while the three headline lines rise into theirs, so the counter seems to turn into the heading. The cover itself only fades. Works well for studios whose homepage leads with big type.
<section class="w2cnt">
<div class="w2cnt-page" data-page="" aria-busy="true">
<header class="w2cnt-nav">
<a href="#" class="w2cnt-brand">Marrow & Pine</a>
<a href="#" class="w2cnt-link">Start a project</a>
</header>
<div class="w2cnt-hero">
<h2 class="w2cnt-title">
<span class="w2cnt-mask"><span class="w2cnt-line">Packaging</span></span>
<span class="w2cnt-mask"><span class="w2cnt-line">people keep</span></span>
<span class="w2cnt-mask"><span class="w2cnt-line">on the shelf.</span></span>
</h2>
<div class="w2cnt-side">
<div class="w2cnt-frame"><img src="https://images.pexels.com/photos/414974/pexels-photo-414974.jpeg?auto=compress&cs=tinysrgb&w=1200" alt="Desk seen from above with a laptop, colour swatches, pencils and sketches" width="1200" height="800" /></div>
<p class="w2cnt-copy">A four-person studio for labels, boxes and the small printed things that go inside them.</p>
<button type="button" class="w2cnt-replay" data-replay="">
<svg viewBox="0 0 20 20" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 10a6 6 0 1 0 1.8-4.3" /><path d="M4 3.5v3.2h3.2" /></svg>
Replay intro
</button>
</div>
</div>
</div>
<div class="w2cnt-cover" data-cover="" aria-hidden="true">
<p class="w2cnt-label">Marrow & Pine, design studio</p>
<p class="w2cnt-big"><span class="w2cnt-mask"><span class="w2cnt-num"><span data-num="">0</span><small>%</small></span></span></p>
<span class="w2cnt-rule"><span data-bar=""></span></span>
</div>
<p class="w2cnt-sr" data-live="" aria-live="polite"></p>
</section>
<style>
/* Change these: colours of the cover and the page. */
.w2cnt { --w2cnt-paper: #f2ece1; --w2cnt-ink: #211c16; --w2cnt-rust: #9a4a26; height: 600px; background: var(--w2cnt-paper); color: var(--w2cnt-ink); font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif; }
.w2cnt-page { height: 100%; display: flex; flex-direction: column; padding: 0 clamp(16px, 4vw, 48px); }
.w2cnt-nav { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.w2cnt-brand { color: inherit; font-family: ui-serif, Georgia, 'Times New Roman', serif; font-size: 20px; font-style: italic; text-decoration: none; }
.w2cnt-link { color: var(--w2cnt-rust); font-size: 14px; font-weight: 600; text-underline-offset: 4px; display: inline-flex; align-items: center; min-height: 40px; }
.w2cnt-hero { flex: 1; display: grid; grid-template-columns: 1.4fr 1fr; gap: clamp(20px, 4vw, 64px); align-items: end; padding-bottom: 44px; min-height: 0; }
.w2cnt-title { margin: 0; font-size: clamp(44px, 8.4vw, 124px); line-height: .94; letter-spacing: -.045em; font-weight: 600; }
.w2cnt-mask { display: block; overflow: hidden; padding-bottom: .06em; }
.w2cnt-line { display: block; transform: translateY(105%); transition: transform .9s cubic-bezier(.2,.75,.15,1); }
.w2cnt-mask:nth-child(2) .w2cnt-line { transition-delay: .08s; } .w2cnt-mask:nth-child(3) .w2cnt-line { transition-delay: .16s; color: var(--w2cnt-rust); }
.w2cnt.is-out .w2cnt-line { transform: none; }
.w2cnt-frame { overflow: hidden; aspect-ratio: 4 / 3; border-radius: 4px; }
.w2cnt-frame img { width: 100%; height: 100%; object-fit: cover; display: block; transform: scale(1.08); transition: transform 1.3s cubic-bezier(.2,.75,.15,1) .2s; }
.w2cnt.is-out .w2cnt-frame img { transform: none; }
.w2cnt-copy { margin: 16px 0 14px; font-size: 15px; line-height: 1.6; color: #4b4339; }
.w2cnt-replay { border: 1px solid #c9bfae; background: #fbf8f2; color: var(--w2cnt-ink); }
.w2cnt-cover { position: absolute; inset: 0; z-index: 2; background: var(--w2cnt-paper); display: flex; flex-direction: column; justify-content: flex-end; padding: 0 clamp(16px, 4vw, 48px) 44px; transition: opacity .5s ease .45s; }
.w2cnt.is-out .w2cnt-cover { opacity: 0; }
.w2cnt-label { position: absolute; top: 26px; left: clamp(16px, 4vw, 48px); margin: 0; font-size: 13px; color: #6a6054; transition: opacity .3s ease; }
.w2cnt.is-out .w2cnt-label { opacity: 0; }
.w2cnt-big { margin: 0; font-size: clamp(110px, 22vw, 300px); line-height: .9; font-weight: 600; letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.w2cnt-num { display: block; transition: transform .6s cubic-bezier(.6,0,.3,1); }
.w2cnt-num small { font-size: .3em; letter-spacing: 0; vertical-align: top; color: var(--w2cnt-rust); }
.w2cnt.is-out .w2cnt-num { transform: translateY(-105%); }
.w2cnt-rule { display: block; height: 2px; margin-top: 18px; background: #ddd3c3; overflow: hidden; }
.w2cnt-rule span { display: block; height: 100%; background: var(--w2cnt-ink); transform: scaleX(0); transform-origin: left; }
@media (max-width: 767px) {
.w2cnt-hero { grid-template-columns: 1fr; align-content: end; gap: 18px; padding-bottom: 28px; }
.w2cnt-frame { aspect-ratio: 16 / 9; max-height: 170px; width: 100%; }
.w2cnt-copy { margin: 12px 0 10px; }
}
.w2cnt { position: relative; overflow: hidden; }
.w2cnt-cover[hidden] { display: none; }
.w2cnt.is-snap, .w2cnt.is-snap * { transition: none !important; }
.w2cnt[data-paused] * { animation-play-state: paused !important; }
.w2cnt-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.w2cnt-replay { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px; font: 600 13px/1 ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
.w2cnt-replay:focus-visible, .w2cnt a:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
.w2cnt *, .w2cnt *::before, .w2cnt *::after { animation: none !important; transition-duration: 0s !important; transition-delay: 0s !important; }
.w2cnt .w2cnt-cover { transition: opacity .45s ease !important; }
.w2cnt.is-out .w2cnt-cover { opacity: 0; }
.w2cnt-cover *:not([data-bar]), .w2cnt-page * { transform: none !important; opacity: 1; }
}
</style>
<script>
(function () {
/* Change these: shortest time the cover shows (ms), longest it may wait for images (ms), exit length (ms). */
var MIN = 1000, CAP = 1500, EXIT = 1100;
/* On a real page: give .w2cnt-cover position: fixed; inset: 0 and put data-page on your <main>. */
var root = document.querySelector(".w2cnt");
if (!root) return;
var page = root.querySelector("[data-page]"), cover = root.querySelector("[data-cover]");
var live = root.querySelector("[data-live]"), again = root.querySelector("[data-replay]");
var nums = root.querySelectorAll("[data-num]"), bars = root.querySelectorAll("[data-bar]"), ticks = root.querySelectorAll("[data-tick]");
var rm = matchMedia("(prefers-reduced-motion: reduce)"), run = 0, frame = 0, seen = true, step = null, timer = 0;
function draw(v) {
var t = String(Math.round(v * 100));
nums.forEach(function (n) { n.textContent = t; });
bars.forEach(function (b) { b.style.transform = "scaleX(" + v + ")"; });
}
function start(refocus) {
var id = ++run, t0 = performance.now(), imgs = page.querySelectorAll("img"), total = imgs.length, done = 0, shown = 0;
cancelAnimationFrame(frame); clearTimeout(timer);
root.classList.add("is-snap"); root.classList.remove("is-out");
cover.hidden = false; void root.offsetWidth; root.classList.remove("is-snap");
page.inert = true; page.setAttribute("aria-busy", "true"); live.textContent = "Loading";
ticks.forEach(function (k) { k.classList.remove("is-on"); });
/* Real progress: one step per image that fires load or error. */
imgs.forEach(function (img, i) {
function hit() { if (id !== run) return; done++; if (ticks[i]) ticks[i].classList.add("is-on"); }
if (img.complete) hit(); else { img.addEventListener("load", hit, { once: true }); img.addEventListener("error", hit, { once: true }); }
});
step = function (now) {
var real = total ? done / total : 1, t = now - t0;
if (t > CAP) real = 1;
shown += (real - shown) * (rm.matches ? 1 : 0.2);
if (real - shown < 0.004) shown = real;
draw(shown);
if (shown === 1 && t >= MIN) {
step = null; frame = 0;
root.classList.add("is-out"); live.textContent = "Page ready";
page.inert = false; page.removeAttribute("aria-busy");
timer = setTimeout(function () { cover.hidden = true; if (refocus) again.focus(); }, rm.matches ? 500 : EXIT);
return;
}
frame = seen ? requestAnimationFrame(step) : 0;
};
frame = requestAnimationFrame(step);
}
/* Off screen: stop the frame loop and pause CSS loops. */
new IntersectionObserver(function (e) {
seen = e[0].isIntersecting;
root.toggleAttribute("data-paused", !seen);
if (seen && step && !frame) frame = requestAnimationFrame(step);
}).observe(root);
again.addEventListener("click", function () { start(true); });
start(false);
})();
</script>
With reduced motion: The number stays put, the headline lines are already in place, and the paper cover just fades out.
Running cost: Text and one photo move by transform; the counter updates its text a few dozen times and then stops.
- Set the paper, ink and accent through `--w2cnt-paper`, `--w2cnt-ink` and `--w2cnt-rust`.
- Change the headline by editing the three `.w2cnt-line` spans; keep one line per mask so each rises on its own.
- Slow the hand-over by raising the `.w2cnt-line` transition from `.9s` and the cover fade delay of `.45s`.
Sand Tile Mosaic Preloader
A dark mosaic of twenty-four tiles hides a gallery page while its two photographs load, with a short status line counting them. Once both are in, the tiles shrink away in a diagonal sweep from the top left, a little like prints coming off a wall. Suits galleries, photographers and archives with a calm, printed feel.
<section class="w2til">
<div class="w2til-page" data-page="" aria-busy="true">
<header class="w2til-nav">
<a href="#" class="w2til-brand">Field Notes Gallery</a>
<a href="#" class="w2til-link">Visit</a>
</header>
<div class="w2til-hero">
<img class="w2til-main" src="https://images.pexels.com/photos/6877573/pexels-photo-6877573.jpeg?auto=compress&cs=tinysrgb&w=1200" alt="Narrow corridor lined with framed photographs under warm lights and a polished wooden floor" width="1200" height="800" />
<div class="w2til-text">
<p class="w2til-kicker">Now showing, ground floor</p>
<h2 class="w2til-title">Quiet Rooms</h2>
<p class="w2til-copy">Black and white photographs of empty interiors, hung close together along the long corridor.</p>
<img class="w2til-small" src="https://images.pexels.com/photos/310435/pexels-photo-310435.jpeg?auto=compress&cs=tinysrgb&w=800" alt="Ten small black and white photographs in black frames hung in two rows on a white wall" width="800" height="540" />
<button type="button" class="w2til-replay" data-replay="">
<svg viewBox="0 0 20 20" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 10a6 6 0 1 0 1.8-4.3" /><path d="M4 3.5v3.2h3.2" /></svg>
Replay intro
</button>
</div>
</div>
</div>
<div class="w2til-cover" data-cover="" aria-hidden="true">
<div class="w2til-grid"><span class="w2til-tile"></span><span class="w2til-tile"></span><span class="w2til-tile"></span><span class="w2til-tile"></span><span class="w2til-tile"></span><span class="w2til-tile"></span><span class="w2til-tile"></span><span class="w2til-tile"></span><span class="w2til-tile"></span><span class="w2til-tile"></span><span class="w2til-tile"></span><span class="w2til-tile"></span><span class="w2til-tile"></span><span class="w2til-tile"></span><span class="w2til-tile"></span><span class="w2til-tile"></span><span class="w2til-tile"></span><span class="w2til-tile"></span><span class="w2til-tile"></span><span class="w2til-tile"></span><span class="w2til-tile"></span><span class="w2til-tile"></span><span class="w2til-tile"></span><span class="w2til-tile"></span></div>
<p class="w2til-pct">Hanging the prints <span data-num="">0</span>%</p>
</div>
<p class="w2til-sr" data-live="" aria-live="polite"></p>
</section>
<style>
/* Change these: colours of the cover and the page. */
.w2til { --w2til-tile: #2b251d; --w2til-sand: #ebe0cc; --w2til-ink: #241f18; height: 600px; background: var(--w2til-sand); color: var(--w2til-ink); font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif; }
.w2til-page { height: 100%; display: flex; flex-direction: column; padding: 0 clamp(16px, 4vw, 48px) clamp(16px, 3vw, 36px); }
.w2til-nav { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.w2til-brand { color: inherit; font-weight: 700; font-size: 15px; letter-spacing: .06em; text-transform: uppercase; text-decoration: none; }
.w2til-link { color: inherit; font-size: 14px; display: inline-flex; align-items: center; min-height: 40px; text-underline-offset: 4px; }
.w2til-hero { flex: 1; display: grid; grid-template-columns: 1.5fr 1fr; gap: clamp(16px, 3vw, 40px); min-height: 0; }
.w2til-main { width: 100%; height: 100%; min-height: 0; object-fit: cover; display: block; border-radius: 2px; }
.w2til-text { display: flex; flex-direction: column; justify-content: flex-end; }
.w2til-kicker { margin: 0; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: #6a5c45; }
.w2til-title { margin: 8px 0 0; font-family: ui-serif, Georgia, 'Times New Roman', serif; font-size: clamp(40px, 5.6vw, 76px); line-height: 1; font-weight: 400; }
.w2til-copy { margin: 14px 0 18px; font-size: 15px; line-height: 1.6; color: #4b4133; }
.w2til-small { width: 100%; height: auto; aspect-ratio: 2 / 1; object-fit: cover; margin-bottom: 18px; border-radius: 2px; }
.w2til-replay { align-self: flex-start; border: 1px solid #bfae90; background: #f5eee1; color: var(--w2til-ink); }
.w2til-cover { position: absolute; inset: 0; z-index: 2; }
.w2til-grid { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(6, 1fr); grid-template-rows: repeat(4, 1fr); }
.w2til-tile { background: var(--w2til-tile); transition: transform .5s cubic-bezier(.6,0,.3,1), opacity .5s ease; margin: -1px; }
.w2til-tile:nth-child(1) { transition-delay: 0.000s; } .w2til-tile:nth-child(2) { transition-delay: 0.045s; } .w2til-tile:nth-child(3) { transition-delay: 0.090s; } .w2til-tile:nth-child(4) { transition-delay: 0.135s; } .w2til-tile:nth-child(5) { transition-delay: 0.180s; } .w2til-tile:nth-child(6) { transition-delay: 0.225s; } .w2til-tile:nth-child(7) { transition-delay: 0.045s; } .w2til-tile:nth-child(8) { transition-delay: 0.090s; } .w2til-tile:nth-child(9) { transition-delay: 0.135s; } .w2til-tile:nth-child(10) { transition-delay: 0.180s; } .w2til-tile:nth-child(11) { transition-delay: 0.225s; } .w2til-tile:nth-child(12) { transition-delay: 0.270s; } .w2til-tile:nth-child(13) { transition-delay: 0.090s; } .w2til-tile:nth-child(14) { transition-delay: 0.135s; } .w2til-tile:nth-child(15) { transition-delay: 0.180s; } .w2til-tile:nth-child(16) { transition-delay: 0.225s; } .w2til-tile:nth-child(17) { transition-delay: 0.270s; } .w2til-tile:nth-child(18) { transition-delay: 0.315s; } .w2til-tile:nth-child(19) { transition-delay: 0.135s; } .w2til-tile:nth-child(20) { transition-delay: 0.180s; } .w2til-tile:nth-child(21) { transition-delay: 0.225s; } .w2til-tile:nth-child(22) { transition-delay: 0.270s; } .w2til-tile:nth-child(23) { transition-delay: 0.315s; } .w2til-tile:nth-child(24) { transition-delay: 0.360s; }
.w2til.is-out .w2til-tile { transform: scale(0); opacity: 0; }
.w2til-pct { position: absolute; left: 0; right: 0; top: 50%; margin: -10px 0 0; text-align: center; font-size: 15px; letter-spacing: .24em; text-transform: uppercase; color: #f1e8d8; font-variant-numeric: tabular-nums; transition: opacity .2s ease; }
.w2til.is-out .w2til-pct { opacity: 0; }
@media (max-width: 767px) {
.w2til-hero { grid-template-columns: 1fr; grid-template-rows: 230px auto; gap: 18px; }
.w2til-text { justify-content: flex-start; }
.w2til-small { display: none; }
.w2til-copy { margin: 10px 0 14px; }
}
.w2til { position: relative; overflow: hidden; }
.w2til-cover[hidden] { display: none; }
.w2til.is-snap, .w2til.is-snap * { transition: none !important; }
.w2til[data-paused] * { animation-play-state: paused !important; }
.w2til-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.w2til-replay { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px; font: 600 13px/1 ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
.w2til-replay:focus-visible, .w2til a:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
.w2til *, .w2til *::before, .w2til *::after { animation: none !important; transition-duration: 0s !important; transition-delay: 0s !important; }
.w2til .w2til-cover { transition: opacity .45s ease !important; }
.w2til.is-out .w2til-cover { opacity: 0; }
.w2til-cover *:not([data-bar]), .w2til-page * { transform: none !important; opacity: 1; }
}
</style>
<script>
(function () {
/* Change these: shortest time the cover shows (ms), longest it may wait for images (ms), exit length (ms). */
var MIN = 1000, CAP = 1500, EXIT = 1050;
/* On a real page: give .w2til-cover position: fixed; inset: 0 and put data-page on your <main>. */
var root = document.querySelector(".w2til");
if (!root) return;
var page = root.querySelector("[data-page]"), cover = root.querySelector("[data-cover]");
var live = root.querySelector("[data-live]"), again = root.querySelector("[data-replay]");
var nums = root.querySelectorAll("[data-num]"), bars = root.querySelectorAll("[data-bar]"), ticks = root.querySelectorAll("[data-tick]");
var rm = matchMedia("(prefers-reduced-motion: reduce)"), run = 0, frame = 0, seen = true, step = null, timer = 0;
function draw(v) {
var t = String(Math.round(v * 100));
nums.forEach(function (n) { n.textContent = t; });
bars.forEach(function (b) { b.style.transform = "scaleX(" + v + ")"; });
}
function start(refocus) {
var id = ++run, t0 = performance.now(), imgs = page.querySelectorAll("img"), total = imgs.length, done = 0, shown = 0;
cancelAnimationFrame(frame); clearTimeout(timer);
root.classList.add("is-snap"); root.classList.remove("is-out");
cover.hidden = false; void root.offsetWidth; root.classList.remove("is-snap");
page.inert = true; page.setAttribute("aria-busy", "true"); live.textContent = "Loading";
ticks.forEach(function (k) { k.classList.remove("is-on"); });
/* Real progress: one step per image that fires load or error. */
imgs.forEach(function (img, i) {
function hit() { if (id !== run) return; done++; if (ticks[i]) ticks[i].classList.add("is-on"); }
if (img.complete) hit(); else { img.addEventListener("load", hit, { once: true }); img.addEventListener("error", hit, { once: true }); }
});
step = function (now) {
var real = total ? done / total : 1, t = now - t0;
if (t > CAP) real = 1;
shown += (real - shown) * (rm.matches ? 1 : 0.2);
if (real - shown < 0.004) shown = real;
draw(shown);
if (shown === 1 && t >= MIN) {
step = null; frame = 0;
root.classList.add("is-out"); live.textContent = "Page ready";
page.inert = false; page.removeAttribute("aria-busy");
timer = setTimeout(function () { cover.hidden = true; if (refocus) again.focus(); }, rm.matches ? 500 : EXIT);
return;
}
frame = seen ? requestAnimationFrame(step) : 0;
};
frame = requestAnimationFrame(step);
}
/* Off screen: stop the frame loop and pause CSS loops. */
new IntersectionObserver(function (e) {
seen = e[0].isIntersecting;
root.toggleAttribute("data-paused", !seen);
if (seen && step && !frame) frame = requestAnimationFrame(step);
}).observe(root);
again.addEventListener("click", function () { start(true); });
start(false);
})();
</script>
With reduced motion: The mosaic does not break apart; the whole dark cover fades in one step to show the exhibition page.
Running cost: Twenty-four small layers scale and fade once each; nothing repaints after the sweep ends.
- Change the tile and page colours through `--w2til-tile` and `--w2til-sand`.
- Use a finer grid by raising the `repeat(6, 1fr)` and `repeat(4, 1fr)` counts and adding matching tile spans and delays.
- Speed up the sweep by lowering the `0.045s` step used in the tile `nth-child` delays.
Slate Checklist Preloader
Instead of a bare number, this cover lists each photo on the page by its caption and ticks a row the moment that image fires its load or error event, with a slim bar summing them up. Then the list lifts away and the three room photos rise in order. Good for interiors, property or product pages where the pictures are the content.
<section class="w2lst">
<div class="w2lst-page" data-page="" aria-busy="true">
<header class="w2lst-nav">
<a href="#" class="w2lst-brand">Northlight Interiors</a>
<nav aria-label="Main"><ul><li><a href="#">Projects</a></li><li><a href="#">Studio</a></li><li><a href="#">Enquire</a></li></ul></nav>
</header>
<div class="w2lst-head">
<h2 class="w2lst-title">Calm rooms for busy households.</h2>
<button type="button" class="w2lst-replay" data-replay="">
<svg viewBox="0 0 20 20" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 10a6 6 0 1 0 1.8-4.3" /><path d="M4 3.5v3.2h3.2" /></svg>
Replay intro
</button>
</div>
<ul class="w2lst-grid">
<li><img src="https://images.pexels.com/photos/12277014/pexels-photo-12277014.jpeg?auto=compress&cs=tinysrgb&w=1200" alt="Beige sofa beside a low wooden console with a potted plant against a white wall" width="1200" height="675" /><p>Living room, oak console</p></li>
<li><img src="https://images.pexels.com/photos/7195900/pexels-photo-7195900.jpeg?auto=compress&cs=tinysrgb&w=1200" alt="Long wooden dining table with black chairs next to a bright white kitchen" width="1200" height="800" /><p>Dining room, walnut table</p></li>
<li><img src="https://images.pexels.com/photos/7031622/pexels-photo-7031622.jpeg?auto=compress&cs=tinysrgb&w=1200" alt="Open plan room with a concrete floor and tall windows looking out over a lake" width="1200" height="800" /><p>Lake house, open plan</p></li>
</ul>
</div>
<div class="w2lst-cover" data-cover="" aria-hidden="true">
<div class="w2lst-box">
<p class="w2lst-label">Northlight Interiors</p>
<ul class="w2lst-list">
<li data-tick=""><span class="w2lst-dot"><svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3.5 8.5l3 3 6-7" /></svg></span>Living room, oak console</li>
<li data-tick=""><span class="w2lst-dot"><svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3.5 8.5l3 3 6-7" /></svg></span>Dining room, walnut table</li>
<li data-tick=""><span class="w2lst-dot"><svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3.5 8.5l3 3 6-7" /></svg></span>Lake house, open plan</li>
</ul>
<div class="w2lst-meter"><span class="w2lst-bar"><span data-bar=""></span></span><span class="w2lst-pct"><span data-num="">0</span>%</span></div>
</div>
</div>
<p class="w2lst-sr" data-live="" aria-live="polite"></p>
</section>
<style>
/* Change these: colours of the cover and the page. */
.w2lst { --w2lst-slate: #2f3a45; --w2lst-white: #ffffff; --w2lst-accent: #3f6f8f; height: 600px; background: var(--w2lst-white); color: var(--w2lst-slate); font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif; }
.w2lst-page { height: 100%; display: flex; flex-direction: column; padding: 0 clamp(16px, 4vw, 48px) clamp(16px, 3vw, 36px); }
.w2lst-nav { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.w2lst-brand { color: inherit; font-weight: 700; text-decoration: none; }
.w2lst-nav ul { display: flex; gap: 26px; margin: 0; padding: 0; list-style: none; }
.w2lst-nav ul a { color: #4f5b67; font-size: 14px; text-decoration: none; }
.w2lst-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 18px 0 26px; }
.w2lst-title { margin: 0; max-width: 40rem; font-size: clamp(30px, 4.6vw, 58px); line-height: 1.04; letter-spacing: -.03em; font-weight: 600; }
.w2lst-replay { flex: none; border: 1px solid #c9d1d9; background: #f5f7f9; color: var(--w2lst-slate); }
.w2lst-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 0; padding: 0; list-style: none; }
.w2lst-grid li { display: flex; flex-direction: column; min-height: 0; transform: translateY(26px); opacity: .001; transition: transform .9s cubic-bezier(.2,.75,.15,1) .25s, opacity .6s ease .25s; }
.w2lst-grid li:nth-child(2) { transition-delay: .35s; } .w2lst-grid li:nth-child(3) { transition-delay: .45s; }
.w2lst.is-out .w2lst-grid li { transform: none; opacity: 1; }
.w2lst-grid img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; display: block; border-radius: 6px; }
.w2lst-grid p { margin: 10px 0 0; font-size: 14px; color: #4f5b67; }
.w2lst-cover { position: absolute; inset: 0; z-index: 2; background: var(--w2lst-white); display: flex; align-items: center; justify-content: center; padding: 16px; transition: opacity .45s ease .35s; }
.w2lst.is-out .w2lst-cover { opacity: 0; }
.w2lst-box { width: min(100%, 380px); transition: transform .6s cubic-bezier(.6,0,.3,1), opacity .4s ease; }
.w2lst.is-out .w2lst-box { transform: translateY(-18px); opacity: 0; }
.w2lst-label { margin: 0 0 18px; font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: #5d6875; }
.w2lst-list { margin: 0; padding: 0; list-style: none; }
.w2lst-list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid #e3e7eb; font-size: 15px; color: #6b7681; transition: color .3s ease; }
.w2lst-list li.is-on { color: var(--w2lst-slate); }
.w2lst-dot { position: relative; display: grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 50%; border: 1.5px solid #c3cbd3; color: #fff; }
.w2lst-dot::before { content: ""; position: absolute; inset: -1.5px; border-radius: 50%; background: var(--w2lst-accent); transform: scale(0); transition: transform .35s cubic-bezier(.3,1.4,.5,1); }
.w2lst-dot svg { position: relative; opacity: 0; transition: opacity .2s ease .1s; }
.w2lst-list li.is-on .w2lst-dot::before { transform: scale(1); }
.w2lst-list li.is-on .w2lst-dot svg { opacity: 1; }
.w2lst-meter { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.w2lst-bar { flex: 1; height: 3px; border-radius: 3px; background: #e3e7eb; overflow: hidden; }
.w2lst-bar span { display: block; height: 100%; background: var(--w2lst-accent); transform: scaleX(0); transform-origin: left; }
.w2lst-pct { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 3.2em; text-align: right; }
@media (max-width: 767px) {
.w2lst-nav ul li:not(:last-child) { display: none; }
.w2lst-head { flex-direction: column; align-items: flex-start; margin: 10px 0 18px; }
.w2lst-grid { grid-template-columns: 1fr 1fr; }
.w2lst-grid li:nth-child(3) { display: none; }
.w2lst-grid p { font-size: 13px; }
}
.w2lst { position: relative; overflow: hidden; }
.w2lst-cover[hidden] { display: none; }
.w2lst.is-snap, .w2lst.is-snap * { transition: none !important; }
.w2lst[data-paused] * { animation-play-state: paused !important; }
.w2lst-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.w2lst-replay { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px; font: 600 13px/1 ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
.w2lst-replay:focus-visible, .w2lst a:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
.w2lst *, .w2lst *::before, .w2lst *::after { animation: none !important; transition-duration: 0s !important; transition-delay: 0s !important; }
.w2lst .w2lst-cover { transition: opacity .45s ease !important; }
.w2lst.is-out .w2lst-cover { opacity: 0; }
.w2lst-cover *:not([data-bar]), .w2lst-page * { transform: none !important; opacity: 1; }
}
</style>
<script>
(function () {
/* Change these: shortest time the cover shows (ms), longest it may wait for images (ms), exit length (ms). */
var MIN = 1100, CAP = 1500, EXIT = 900;
/* On a real page: give .w2lst-cover position: fixed; inset: 0 and put data-page on your <main>. */
var root = document.querySelector(".w2lst");
if (!root) return;
var page = root.querySelector("[data-page]"), cover = root.querySelector("[data-cover]");
var live = root.querySelector("[data-live]"), again = root.querySelector("[data-replay]");
var nums = root.querySelectorAll("[data-num]"), bars = root.querySelectorAll("[data-bar]"), ticks = root.querySelectorAll("[data-tick]");
var rm = matchMedia("(prefers-reduced-motion: reduce)"), run = 0, frame = 0, seen = true, step = null, timer = 0;
function draw(v) {
var t = String(Math.round(v * 100));
nums.forEach(function (n) { n.textContent = t; });
bars.forEach(function (b) { b.style.transform = "scaleX(" + v + ")"; });
}
function start(refocus) {
var id = ++run, t0 = performance.now(), imgs = page.querySelectorAll("img"), total = imgs.length, done = 0, shown = 0;
cancelAnimationFrame(frame); clearTimeout(timer);
root.classList.add("is-snap"); root.classList.remove("is-out");
cover.hidden = false; void root.offsetWidth; root.classList.remove("is-snap");
page.inert = true; page.setAttribute("aria-busy", "true"); live.textContent = "Loading";
ticks.forEach(function (k) { k.classList.remove("is-on"); });
/* Real progress: one step per image that fires load or error. */
imgs.forEach(function (img, i) {
function hit() { if (id !== run) return; done++; if (ticks[i]) ticks[i].classList.add("is-on"); }
if (img.complete) hit(); else { img.addEventListener("load", hit, { once: true }); img.addEventListener("error", hit, { once: true }); }
});
step = function (now) {
var real = total ? done / total : 1, t = now - t0;
if (t > CAP) real = 1;
shown += (real - shown) * (rm.matches ? 1 : 0.2);
if (real - shown < 0.004) shown = real;
draw(shown);
if (shown === 1 && t >= MIN) {
step = null; frame = 0;
root.classList.add("is-out"); live.textContent = "Page ready";
page.inert = false; page.removeAttribute("aria-busy");
timer = setTimeout(function () { cover.hidden = true; if (refocus) again.focus(); }, rm.matches ? 500 : EXIT);
return;
}
frame = seen ? requestAnimationFrame(step) : 0;
};
frame = requestAnimationFrame(step);
}
/* Off screen: stop the frame loop and pause CSS loops. */
new IntersectionObserver(function (e) {
seen = e[0].isIntersecting;
root.toggleAttribute("data-paused", !seen);
if (seen && step && !frame) frame = requestAnimationFrame(step);
}).observe(root);
again.addEventListener("click", function () { start(true); });
start(false);
})();
</script>
With reduced motion: Rows still tick as photos arrive, then the white cover fades straight to the finished grid.
Running cost: Each tick is a class swap on one row, and the only loop is the short one easing the bar.
- Keep the cover list in the same order as the page's images, since row one ticks when image one loads.
- Change the tick and bar colour with `--w2lst-accent` and the text colour with `--w2lst-slate`.
- Rename the rows to match your own photo captions so the cover tells people what is on its way.
Terracotta Double Wipe Preloader
A dark clay panel with the shop's name and a percentage covers the page while the two product photos load. When they are in, the dark panel wipes off to the right with a terracotta panel a beat behind it, and the vases rise into place one after the other. Fits small shops with a warm, handmade look.
<section class="w2wip">
<div class="w2wip-page" data-page="" aria-busy="true">
<header class="w2wip-nav">
<a href="#" class="w2wip-brand">Clayhouse</a>
<nav aria-label="Shop"><ul><li><a href="#">Vases</a></li><li><a href="#">Tableware</a></li><li><a href="#">Classes</a></li></ul></nav>
</header>
<div class="w2wip-hero">
<div>
<h2 class="w2wip-title">Stoneware thrown and glazed by hand on Hollis Street.</h2>
<p class="w2wip-copy">New vases come out of the kiln every second Friday. Each one is signed on the foot.</p>
<div class="w2wip-row"><a href="#" class="w2wip-cta">Shop this firing</a><button type="button" class="w2wip-replay" data-replay="">
<svg viewBox="0 0 20 20" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 10a6 6 0 1 0 1.8-4.3" /><path d="M4 3.5v3.2h3.2" /></svg>
Replay intro
</button></div>
</div>
<div class="w2wip-pics">
<figure><img src="https://images.pexels.com/photos/15122643/pexels-photo-15122643.jpeg?auto=compress&cs=tinysrgb&w=1200" alt="Rows of matte white ceramic vases in different shapes on a wooden shelf" width="1200" height="800" /><figcaption>White matte, tall forms</figcaption></figure>
<figure><img src="https://images.pexels.com/photos/8063872/pexels-photo-8063872.jpeg?auto=compress&cs=tinysrgb&w=1200" alt="Glazed white vases and jugs lined up on a pottery studio shelf" width="1200" height="800" /><figcaption>Gloss glaze, small jugs</figcaption></figure>
</div>
</div>
</div>
<div class="w2wip-cover" data-cover="" aria-hidden="true">
<span class="w2wip-back"></span>
<div class="w2wip-front">
<p class="w2wip-word">Clayhouse</p>
<p class="w2wip-pct">Unloading the kiln <span data-num="">0</span>%</p>
</div>
</div>
<p class="w2wip-sr" data-live="" aria-live="polite"></p>
</section>
<style>
/* Change these: colours of the cover and the page. */
.w2wip { --w2wip-front: #3a231a; --w2wip-back: #b4552f; --w2wip-page: #f5ece2; height: 600px; background: var(--w2wip-page); color: #2b1a13; font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif; }
.w2wip-page { height: 100%; display: flex; flex-direction: column; padding: 0 clamp(16px, 4vw, 48px); }
.w2wip-nav { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.w2wip-brand { color: var(--w2wip-back); font-family: ui-serif, Georgia, 'Times New Roman', serif; font-size: 22px; font-weight: 700; text-decoration: none; }
.w2wip-nav ul { display: flex; gap: 26px; margin: 0; padding: 0; list-style: none; }
.w2wip-nav ul a { color: #5a4135; font-size: 14px; text-decoration: none; }
.w2wip-hero { flex: 1; display: grid; grid-template-columns: 1fr 1.3fr; gap: clamp(20px, 4vw, 56px); align-items: center; min-height: 0; padding-bottom: 24px; }
.w2wip-title { margin: 0; font-family: ui-serif, Georgia, 'Times New Roman', serif; font-size: clamp(30px, 4.2vw, 52px); line-height: 1.08; font-weight: 400; }
.w2wip-copy { margin: 18px 0 0; font-size: 16px; line-height: 1.6; color: #5a4135; max-width: 28rem; }
.w2wip-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.w2wip-cta { display: inline-flex; align-items: center; min-height: 44px; padding: 0 22px; border-radius: 999px; background: #9e4423; color: #fff8f2; font-size: 14px; font-weight: 600; text-decoration: none; }
.w2wip-replay { border: 1px solid #d9c3b2; background: #fffaf5; color: #3a231a; }
.w2wip-pics { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.w2wip-pics figure { margin: 0; }
.w2wip-pics img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 3px; transform: translateY(18px); opacity: .001; transition: transform .9s cubic-bezier(.2,.75,.15,1) .35s, opacity .6s ease .35s; }
.w2wip-pics figure + figure img { transition-delay: .48s; margin-top: 36px; }
.w2wip.is-out .w2wip-pics img { transform: none; opacity: 1; }
.w2wip-pics figcaption { margin-top: 8px; font-size: 13px; color: #6b4e40; }
.w2wip-cover { position: absolute; inset: 0; z-index: 2; }
.w2wip-back, .w2wip-front { position: absolute; inset: 0; transition: transform .75s cubic-bezier(.75,0,.2,1); }
.w2wip-back { background: var(--w2wip-back); transition-delay: .16s; }
.w2wip-front { background: var(--w2wip-front); color: #f3e3d6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.w2wip.is-out .w2wip-back, .w2wip.is-out .w2wip-front { transform: translateX(101%); }
.w2wip-word { margin: 0; font-family: ui-serif, Georgia, 'Times New Roman', serif; font-size: clamp(48px, 9vw, 104px); font-weight: 700; letter-spacing: -.02em; }
.w2wip-pct { margin: 0; font-size: 13px; letter-spacing: .18em; text-transform: uppercase; color: #d9b9a4; font-variant-numeric: tabular-nums; }
@media (max-width: 767px) {
.w2wip-nav ul li:not(:first-child) { display: none; }
.w2wip-hero { grid-template-columns: 1fr; align-content: start; gap: 20px; }
.w2wip-pics img { aspect-ratio: 4 / 3; }
.w2wip-pics figure + figure img { margin-top: 0; }
.w2wip-copy { font-size: 15px; margin-top: 12px; }
.w2wip-row { margin-top: 18px; }
}
.w2wip { position: relative; overflow: hidden; }
.w2wip-cover[hidden] { display: none; }
.w2wip.is-snap, .w2wip.is-snap * { transition: none !important; }
.w2wip[data-paused] * { animation-play-state: paused !important; }
.w2wip-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.w2wip-replay { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px; font: 600 13px/1 ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
.w2wip-replay:focus-visible, .w2wip a:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
.w2wip *, .w2wip *::before, .w2wip *::after { animation: none !important; transition-duration: 0s !important; transition-delay: 0s !important; }
.w2wip .w2wip-cover { transition: opacity .45s ease !important; }
.w2wip.is-out .w2wip-cover { opacity: 0; }
.w2wip-cover *:not([data-bar]), .w2wip-page * { transform: none !important; opacity: 1; }
}
</style>
<script>
(function () {
/* Change these: shortest time the cover shows (ms), longest it may wait for images (ms), exit length (ms). */
var MIN = 900, CAP = 1500, EXIT = 1100;
/* On a real page: give .w2wip-cover position: fixed; inset: 0 and put data-page on your <main>. */
var root = document.querySelector(".w2wip");
if (!root) return;
var page = root.querySelector("[data-page]"), cover = root.querySelector("[data-cover]");
var live = root.querySelector("[data-live]"), again = root.querySelector("[data-replay]");
var nums = root.querySelectorAll("[data-num]"), bars = root.querySelectorAll("[data-bar]"), ticks = root.querySelectorAll("[data-tick]");
var rm = matchMedia("(prefers-reduced-motion: reduce)"), run = 0, frame = 0, seen = true, step = null, timer = 0;
function draw(v) {
var t = String(Math.round(v * 100));
nums.forEach(function (n) { n.textContent = t; });
bars.forEach(function (b) { b.style.transform = "scaleX(" + v + ")"; });
}
function start(refocus) {
var id = ++run, t0 = performance.now(), imgs = page.querySelectorAll("img"), total = imgs.length, done = 0, shown = 0;
cancelAnimationFrame(frame); clearTimeout(timer);
root.classList.add("is-snap"); root.classList.remove("is-out");
cover.hidden = false; void root.offsetWidth; root.classList.remove("is-snap");
page.inert = true; page.setAttribute("aria-busy", "true"); live.textContent = "Loading";
ticks.forEach(function (k) { k.classList.remove("is-on"); });
/* Real progress: one step per image that fires load or error. */
imgs.forEach(function (img, i) {
function hit() { if (id !== run) return; done++; if (ticks[i]) ticks[i].classList.add("is-on"); }
if (img.complete) hit(); else { img.addEventListener("load", hit, { once: true }); img.addEventListener("error", hit, { once: true }); }
});
step = function (now) {
var real = total ? done / total : 1, t = now - t0;
if (t > CAP) real = 1;
shown += (real - shown) * (rm.matches ? 1 : 0.2);
if (real - shown < 0.004) shown = real;
draw(shown);
if (shown === 1 && t >= MIN) {
step = null; frame = 0;
root.classList.add("is-out"); live.textContent = "Page ready";
page.inert = false; page.removeAttribute("aria-busy");
timer = setTimeout(function () { cover.hidden = true; if (refocus) again.focus(); }, rm.matches ? 500 : EXIT);
return;
}
frame = seen ? requestAnimationFrame(step) : 0;
};
frame = requestAnimationFrame(step);
}
/* Off screen: stop the frame loop and pause CSS loops. */
new IntersectionObserver(function (e) {
seen = e[0].isIntersecting;
root.toggleAttribute("data-paused", !seen);
if (seen && step && !frame) frame = requestAnimationFrame(step);
}).observe(root);
again.addEventListener("click", function () { start(true); });
start(false);
})();
</script>
With reduced motion: Both clay panels stay where they are and the cover fades out in one soft step.
Running cost: Two full-size layers translate once and two photos fade in; no loop runs after the reveal.
- Recolour the two wipe layers with `--w2wip-front` and `--w2wip-back`.
- Make the wipe go left instead by changing both `translateX(101%)` values to `translateX(-101%)`.
- Widen the gap between the two layers by raising the `.16s` delay on `.w2wip-back`.
Performance notes
The cover is one fixed layer that animates its transform and opacity, so lifting it never makes the page below lay out again. Progress comes from load events the browser already fires, counted in a few lines of script, and the screen removes itself from the page when it has gone so it stops costing anything.
A preloader cannot make a slow page faster, and a heavy one makes it slower. Each of these is plain CSS and markup with no images or fonts of its own, so it paints on the first frame, before the things it is waiting for.
Questions
Is a preloader bad for SEO?
Not if the content is in the HTML underneath. Search engines read the page itself, not the cover. Problems start when the content is only added after the intro finishes, or when the intro holds back the page long enough to hurt loading metrics.
How do I show real loading progress?
Count the things you are waiting for, such as the images in the first screen, and add one each time an image fires load or error. Divide by the total for the percentage. Do not animate to 100 on a timer and call it progress.
How long should a page loading screen stay?
Only as long as the page needs. Leave as soon as the first screen's content is ready, and set a firm limit of a few seconds so a slow image never keeps someone waiting on the cover.
What should people with reduced motion see?
A plain cover that fades out when the page is ready, with no sliding panels, spinning marks or counting numbers. Every loader here switches to that under prefers-reduced-motion.
Also in the gallery: 117 CSS Loaders and Spinners You Can Copy.
More collections: Page Transitions With the View Transitions API, Scroll Animations Without a Library, Number Counter Animations. All loaders. Build your site free to have a full site built around them.
Product
Who It's For
- For Agencies
- For Freelancers
- For Hosting Providers
- For SaaS Platforms
- For Startups
- For Financial Services
- For Healthcare
Features
Resources
- Blog
- Help Center
- Free Business Tools
- Free UI Components
- Website Templates
- Template Collections
- Website Examples
- Guides
- Comparisons
- Alternatives
- Best Lists
- Reviews
- Pricing Guides
- Use Cases
- Glossary & Guides
- Integrations
- Developers
- Benchmark
- Windows App