Haze hero
Canvas sunburst and red haze following the pointer, a ghost-trailed mock screen that swaps every few seconds, credits hung off a center column and a hairline title across the full width.
Part of the style
Teal Haze Lab
6 parts that belong together, with their tokens, type and rules.
https://kitbash.me/components/teal-haze-lab/hero/figma.html?palette=ffd602dbfc89ae89
Use the Figma MCP server (https://mcp.figma.com/mcp). Download https://kitbash.me/components/teal-haze-lab/hero/figma.html?palette=ffd602dbfc89ae89 and pass that whole HTML document to the html_to_figma tool, so the part "Haze hero" lands as editable layers in my open Figma file. Fonts come from Google Fonts: if a face is missing in Figma, pick the closest one.
Code
<style>
/* Goes after the pack's base.css */
:root {
--field: #253b6d;
--ink: #f8fafc;
--night: #eaf5ff;
--night-ink: #010937;
--screen: #bdcbd9;
--screen-ink: #010937;
--paper: #010937;
--ray: #42547b;
--glow: #5e6d8e;
--field-deep: #637cb2;
--field-bright: #466abf;
--lilac: #516997;
--pink: #586b94;
}
</style>
<section class="hero">
<canvas class="hero__field" aria-hidden="true"></canvas>
<div class="hero__credits">
<p class="hero__credit hero__credit--after" data-scramble>Wren Halloway</p>
<p class="hero__credit hero__credit--before" data-scramble>Sound carpenter<br>Light rigger</p>
<p class="hero__credit hero__credit--after" data-scramble>Building rooms<br>that listen back</p>
<p class="hero__credit hero__credit--before" data-scramble>Installations<br>and live sets</p>
<p class="hero__credit hero__credit--after" data-scramble>Tuning the city<br>a little quieter<br>with<br>contact mics<br>tape loops<br>slow light</p>
<div class="hero__credit-row">
<a class="hero__credit hero__credit--before hero__mail" href="#">hello@halloway.studio</a>
<p class="hero__credit hero__credit--after">Booking spring<br>March 2027</p>
</div>
</div>
<div class="hero__glimpse">
<div class="hero__card" role="img" aria-label="Rotating previews of past installations">
<div class="hero__screen hero__screen--dark is-current">
<span class="hero__screen-bar"></span>
<span class="hero__screen-head">Quiet rooms,<br>loud ideas.</span>
<span class="hero__screen-ribbon">listen through the walls · listen through the walls</span>
</div>
<div class="hero__screen hero__screen--lilac">
<span class="hero__screen-bar"></span>
<span class="hero__screen-disc"></span>
<span class="hero__screen-head">Field<br>Radio</span>
</div>
<div class="hero__screen hero__screen--paper">
<span class="hero__screen-bar"></span>
<span class="hero__screen-head">Salt Organ</span>
<span class="hero__screen-blocks"><i></i><i></i><i></i></span>
</div>
<div class="hero__screen hero__screen--night">
<span class="hero__screen-bar"></span>
<span class="hero__screen-burst"></span>
<span class="hero__screen-head">Night<br>Ferry</span>
</div>
<div class="hero__screen hero__screen--teal">
<span class="hero__screen-bar"></span>
<span class="hero__screen-rings"></span>
<span class="hero__screen-head">Tide<br>Choir</span>
</div>
<div class="hero__screen hero__screen--paper">
<span class="hero__screen-bar"></span>
<span class="hero__screen-number">06</span>
<span class="hero__screen-strip"></span>
</div>
</div>
</div>
<p class="hero__count">Glimpses of work<span class="hero__count-index"><span class="hero__count-now">01</span> of 06</span></p>
<h1 class="hero__title"><span class="hero__title-line">Sound Carpenter</span></h1>
</section>
<style>
.hero {
--hero-center: 25%;
--hero-title-size: var(--display-xl);
--hero-title-room: calc(var(--hero-title-size) * 0.9);
position: relative;
isolation: isolate;
height: clamp(600px, 62.5vw, 900px);
overflow: hidden;
color: var(--ink);
}
.hero::after {
content: "";
position: absolute;
inset: 0;
z-index: 0;
pointer-events: none;
opacity: var(--grain);
mix-blend-mode: multiply;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
}
.hero__field {
position: absolute;
inset: 0;
z-index: -1;
width: 100%;
height: 100%;
max-width: none;
color: var(--field);
}
/* Credits hang off one invisible column: "before" ends on its left, "after" starts on its right. */
.hero__credits {
position: absolute;
z-index: 1;
top: 72px;
left: var(--edge);
right: 50%;
bottom: calc(var(--hero-title-room) + var(--space-l));
display: flex;
flex-direction: column;
justify-content: space-between;
}
.hero__credit {
margin: 0;
text-decoration: none;
}
.hero__credit--before {
width: calc(var(--hero-center) / 0.5 - var(--gap) / 2);
text-align: right;
}
.hero__credit--after {
margin-left: calc(var(--hero-center) / 0.5 + var(--gap) / 2);
}
.hero__credit-row {
display: flex;
align-items: flex-end;
}
.hero__credit-row .hero__credit--after {
margin-left: var(--gap);
order: 2;
align-self: flex-start;
}
.hero__mail {
flex: none;
display: flex;
align-items: flex-end;
justify-content: flex-end;
min-height: var(--tap);
padding-top: var(--label-line);
}
.hero__mail:hover,
.hero__mail:focus-visible {
text-decoration: underline;
text-underline-offset: 3px;
outline: none;
}
.hero__glimpse {
position: absolute;
z-index: 2;
left: 52%;
top: 46%;
width: clamp(150px, 14vw, 230px);
aspect-ratio: 3 / 2;
perspective: 700px;
pointer-events: none;
}
.hero__card,
.hero__ghost {
position: absolute;
inset: 0;
will-change: transform;
}
.hero__ghost {
opacity: var(--ghost-opacity, 0.3);
filter: blur(0.6px);
}
.hero__screen {
position: absolute;
inset: 0;
overflow: hidden;
border-radius: var(--radius);
opacity: 0;
font-family: var(--font-display);
text-transform: none;
letter-spacing: 0;
}
.hero__screen.is-current {
opacity: 1;
}
.hero__screen-bar {
position: absolute;
top: 7%;
left: 6%;
right: 6%;
height: 2px;
background: currentColor;
opacity: 0.35;
box-shadow: 0 0 0 0 transparent;
}
.hero__screen-head {
position: absolute;
left: 7%;
top: 22%;
font-size: clamp(16px, 1.55vw, 26px);
line-height: 0.95;
}
.hero__screen--dark {
background: var(--screen);
color: var(--screen-ink);
}
.hero__screen--dark .hero__screen-head {
font-family: var(--font-body);
font-size: clamp(14px, 1.3vw, 22px);
}
.hero__screen-ribbon {
position: absolute;
left: -4%;
right: -4%;
bottom: 9%;
padding: 2px 0;
background: var(--ray);
color: var(--screen);
font-family: var(--font-body);
font-size: 7px;
letter-spacing: 0.06em;
text-transform: uppercase;
white-space: nowrap;
rotate: -3deg;
}
.hero__screen--lilac {
background: var(--lilac);
color: var(--ink);
}
.hero__screen-disc {
position: absolute;
right: 9%;
bottom: 12%;
width: 38%;
aspect-ratio: 1;
border-radius: 50%;
background: radial-gradient(circle at 35% 35%, var(--pink), var(--ray) 55%, var(--screen) 100%);
}
.hero__screen--paper {
background: var(--paper);
color: var(--ink);
}
.hero__screen-blocks {
position: absolute;
left: 7%;
right: 7%;
bottom: 10%;
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 5%;
height: 38%;
}
.hero__screen-blocks i {
background: linear-gradient(160deg, var(--field-deep), var(--screen));
}
.hero__screen-blocks i:nth-child(2) {
background: linear-gradient(200deg, var(--glow), var(--screen));
}
.hero__screen--night {
background: var(--night);
color: var(--night-ink);
}
.hero__screen-burst {
position: absolute;
inset: -30%;
background: repeating-conic-gradient(from 10deg at 70% 60%, var(--ray) 0deg 4deg, transparent 4deg 30deg);
mask-image: radial-gradient(circle at 70% 60%, #000 0%, transparent 55%);
-webkit-mask-image: radial-gradient(circle at 70% 60%, #000 0%, transparent 55%);
}
.hero__screen--teal {
background: var(--field-deep);
color: var(--screen-ink);
}
.hero__screen-rings {
position: absolute;
right: -12%;
top: 10%;
width: 70%;
aspect-ratio: 1;
border-radius: 50%;
background: repeating-radial-gradient(circle, transparent 0 6px, var(--field-bright) 6px 7px);
}
.hero__screen-number {
position: absolute;
left: 6%;
bottom: 4%;
font-size: clamp(48px, 5vw, 84px);
font-weight: var(--display-weight);
font-stretch: var(--display-stretch);
line-height: 0.8;
}
.hero__screen-strip {
position: absolute;
right: 6%;
top: 22%;
width: 36%;
height: 56%;
background: var(--lilac);
}
.hero__count {
position: absolute;
z-index: 1;
left: 58.5%;
bottom: calc(var(--hero-title-room) + var(--space-l));
width: 12%;
min-width: 140px;
margin: 0;
}
.hero__count-index {
display: block;
text-align: right;
}
.hero__title {
position: absolute;
z-index: 1;
left: 0;
right: 0;
bottom: calc(var(--hero-title-size) * 0.08);
margin: 0;
font-family: var(--font-display);
font-size: var(--hero-title-size);
font-weight: var(--display-weight);
font-stretch: var(--display-stretch);
line-height: 0.8;
letter-spacing: var(--display-track);
text-align: center;
white-space: nowrap;
}
.hero__title-line {
display: inline-block;
}
@media (max-width: 40rem) {
.hero {
display: flex;
flex-direction: column;
align-items: center;
height: auto;
min-height: 640px;
padding: 112px var(--edge) var(--space-l);
}
.hero__credits,
.hero__count,
.hero__title,
.hero__glimpse {
position: relative;
inset: auto;
}
.hero__credits {
display: block;
text-align: center;
}
.hero__credits > :nth-child(n + 3) {
display: none;
}
.hero__credit--before,
.hero__credit--after {
width: auto;
margin: 0;
text-align: center;
}
.hero__title {
order: 2;
margin: var(--space-l) 0;
font-size: 17vw;
line-height: 0.86;
white-space: normal;
}
.hero__glimpse {
order: 3;
width: min(64%, 240px);
}
.hero__count {
order: 4;
width: min(60%, 220px);
margin-top: var(--space-l);
}
}
@media (prefers-reduced-motion: reduce) {
.hero__ghost {
display: none;
}
}
</style>
<script>
(() => {
const still = matchMedia('(prefers-reduced-motion: reduce)');
const glyphs = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_/#%';
const trailLength = 5;
const trailSpacing = 4;
const token = (element, name) => getComputedStyle(element).getPropertyValue(name).trim();
const rgba = (hex, alpha) => {
const value = parseInt(hex.replace('#', ''), 16);
return `rgba(${value >> 16}, ${(value >> 8) & 255}, ${value & 255}, ${alpha})`;
};
function scrambleText(node, step) {
const lines = node.dataset.lines.split('|');
let frame = 0;
clearInterval(node.scrambleTimer);
node.scrambleTimer = setInterval(() => {
const settled = Math.floor(frame / 1.4);
node.innerHTML = lines.map((line) => [...line].map((letter, index) =>
index < settled || letter === ' ' ? letter : glyphs[Math.floor(Math.random() * glyphs.length)]
).join('')).join('<br>');
frame += 1;
if (lines.every((line) => settled >= line.length)) clearInterval(node.scrambleTimer);
}, step);
}
function setUpCredits(hero) {
const step = parseFloat(token(hero, '--scramble-step')) || 34;
hero.querySelectorAll('[data-scramble]').forEach((node) => {
node.dataset.lines = node.innerText.split('\n').join('|');
node.setAttribute('aria-label', node.innerText.replace(/\n/g, ' '));
node.addEventListener('pointerenter', () => { if (!still.matches) scrambleText(node, step); });
if (!still.matches) scrambleText(node, step);
});
}
function fitTitle(hero) {
const title = hero.querySelector('.hero__title');
const line = hero.querySelector('.hero__title-line');
hero.style.removeProperty('--hero-title-size');
if (getComputedStyle(title).whiteSpace !== 'nowrap') return;
const size = parseFloat(getComputedStyle(title).fontSize);
const room = title.clientWidth - 8;
hero.style.setProperty('--hero-title-size', `${(size * room / line.offsetWidth).toFixed(1)}px`);
}
function paintField(context, width, height, focus, seconds, colors) {
const radius = Math.max(width, height);
context.fillStyle = colors.field;
context.fillRect(0, 0, width, height);
const rays = context.createConicGradient(seconds * 0.05, focus.x, focus.y);
const count = 9;
for (let index = 0; index < count; index += 1) {
const start = index / count;
const width = (0.18 + 0.14 * Math.sin(seconds * 0.4 + index * 2.1)) / count;
rays.addColorStop(start, colors.field);
rays.addColorStop(start + width, colors.bright);
rays.addColorStop(start + width * 2, colors.field);
}
rays.addColorStop(1, colors.field);
context.globalAlpha = 0.55;
context.fillStyle = rays;
context.fillRect(0, 0, width, height);
context.globalAlpha = 1;
const calm = context.createRadialGradient(focus.x, focus.y, 0, focus.x, focus.y, radius * 0.38);
calm.addColorStop(0, colors.field);
calm.addColorStop(1, rgba(colors.field, 0));
context.fillStyle = calm;
context.fillRect(0, 0, width, height);
const haze = context.createRadialGradient(focus.x, focus.y, 0, focus.x, focus.y, radius * 0.26);
haze.addColorStop(0, rgba(colors.glow, 0.7));
haze.addColorStop(0.4, rgba(colors.glow, 0.28));
haze.addColorStop(1, rgba(colors.glow, 0));
context.fillStyle = haze;
context.fillRect(0, 0, width, height);
}
function addGhosts(glimpse, card) {
const ghosts = [];
for (let index = trailLength; index >= 1; index -= 1) {
const ghost = card.cloneNode(true);
ghost.className = 'hero__ghost';
ghost.removeAttribute('role');
ghost.removeAttribute('aria-label');
ghost.setAttribute('aria-hidden', 'true');
ghost.style.setProperty('--ghost-opacity', (0.42 - index * 0.06).toFixed(2));
glimpse.insertBefore(ghost, card);
ghosts[index - 1] = ghost;
}
return ghosts;
}
function showScreen(card, ghosts, counter, index) {
[card, ...ghosts].forEach((frame) => {
frame.querySelectorAll('.hero__screen').forEach((screen, order) => screen.classList.toggle('is-current', order === index));
});
counter.textContent = String(index + 1).padStart(2, '0');
}
function run(hero) {
const canvas = hero.querySelector('.hero__field');
const glimpse = hero.querySelector('.hero__glimpse');
const card = hero.querySelector('.hero__card');
const counter = hero.querySelector('.hero__count-now');
const screenCount = card.querySelectorAll('.hero__screen').length;
const ghosts = addGhosts(glimpse, card);
const context = canvas.getContext('2d');
const buffer = document.createElement('canvas');
const bufferContext = buffer.getContext('2d');
const colors = { field: token(hero, '--field'), bright: token(hero, '--field-bright'), glow: token(hero, '--glow') };
let pointer = null;
let offset = { x: 0, y: 0 };
let lastOffset = { x: 0, y: 0 };
let focus = null;
const history = [];
let frame = 0;
let screenTimer = 0;
let screenIndex = 0;
const fit = () => {
const density = Math.min(2, devicePixelRatio || 1);
canvas.width = hero.clientWidth * density;
canvas.height = hero.clientHeight * density;
buffer.width = Math.max(1, Math.round(hero.clientWidth / 8));
buffer.height = Math.max(1, Math.round(hero.clientHeight / 8));
fitTitle(hero);
draw(performance.now());
};
const home = () => {
const box = glimpse.getBoundingClientRect();
const root = hero.getBoundingClientRect();
return { x: box.left - root.left + box.width / 2, y: box.top - root.top + box.height / 2, width: root.width };
};
const draw = (now) => {
const seconds = now / 1000;
const base = home();
const moving = !still.matches;
let target = { x: 0, y: 0 };
if (moving && pointer) target = { x: (pointer.x - base.x) * 0.6, y: (pointer.y - base.y) * 0.6 };
else if (moving) target = { x: Math.sin(seconds * 0.7) * base.width * 0.1, y: Math.sin(seconds * 1.4) * base.width * 0.035 };
lastOffset = offset;
offset = { x: offset.x + (target.x - offset.x) * 0.08, y: offset.y + (target.y - offset.y) * 0.08 };
const speed = { x: offset.x - lastOffset.x, y: offset.y - lastOffset.y };
history.unshift({ ...offset, tilt: Math.max(-28, Math.min(28, speed.x * 2.4)), lean: Math.max(-14, Math.min(14, speed.y * 2)) });
history.length = Math.min(history.length, trailLength * trailSpacing + 1);
const place = (element, state) => {
element.style.transform = `translate3d(${state.x}px, ${state.y}px, 0) rotateY(${state.tilt}deg) rotateX(${-state.lean}deg)`;
};
place(card, history[0]);
ghosts.forEach((ghost, index) => place(ghost, history[Math.min(history.length - 1, (index + 1) * trailSpacing)]));
const spot = { x: base.x + offset.x, y: base.y + offset.y };
focus = focus ? { x: focus.x + (spot.x - focus.x) * 0.04, y: focus.y + (spot.y - focus.y) * 0.04 } : spot;
const scale = buffer.width / hero.clientWidth;
paintField(bufferContext, buffer.width, buffer.height, { x: focus.x * scale, y: focus.y * scale }, seconds, colors);
context.imageSmoothingEnabled = true;
context.imageSmoothingQuality = 'high';
context.drawImage(buffer, 0, 0, canvas.width, canvas.height);
};
const tick = (now) => {
draw(now);
frame = requestAnimationFrame(tick);
};
const start = () => {
stop();
if (still.matches) return;
frame = requestAnimationFrame(tick);
screenTimer = setInterval(() => {
screenIndex = (screenIndex + 1) % screenCount;
showScreen(card, ghosts, counter, screenIndex);
}, 2800);
};
const stop = () => {
cancelAnimationFrame(frame);
clearInterval(screenTimer);
};
hero.addEventListener('pointermove', (event) => {
const root = hero.getBoundingClientRect();
pointer = { x: event.clientX - root.left, y: event.clientY - root.top };
});
hero.addEventListener('pointerleave', () => { pointer = null; });
new ResizeObserver(fit).observe(hero);
document.fonts.ready.then(() => fitTitle(hero));
new IntersectionObserver(([entry]) => {
if (entry.isIntersecting) start();
else stop();
}).observe(hero);
setUpCredits(hero);
}
document.querySelectorAll('.hero').forEach(run);
})();
</script>