Opening reel frame
One wide picture tile with Play and Mute chips; playing opens the frame out to the page edges, pans the picture slowly and runs a progress bar.
Part of the style
Highlighter Word Chips
6 parts that belong together, with their tokens, type and rules.
https://kitbash.me/components/highlighter-word-chips/reel/figma.html?type=pixel-redaction-notes
Use the Figma MCP server (https://mcp.figma.com/mcp). Download https://kitbash.me/components/highlighter-word-chips/reel/figma.html?type=pixel-redaction-notes and pass that whole HTML document to the html_to_figma tool, so the part "Opening reel frame" 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 */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500&family=JetBrains+Mono:wght@400&display=swap");
:root {
--font-display: "Inter", system-ui, sans-serif;
--font-body: "Inter", system-ui, sans-serif;
}
</style>
<section class="reel" aria-label="Studio reel">
<div class="reel__frame">
<img class="reel__img" src="assets/hamamatsu.jpg" alt="A woodblock print of travellers passing a town of low roofs under a castle and pine trees" width="1200" height="894">
<div class="reel__bar" aria-hidden="true"><span class="reel__progress"></span></div>
<div class="reel__controls">
<button class="reel__button reel__button--play" type="button" aria-pressed="false">Play</button>
<button class="reel__button reel__button--mute" type="button" aria-pressed="false">Mute</button>
</div>
</div>
<p class="reel__caption">
<span class="reel__chip reel__chip--title">Reel 2027</span>
<span class="reel__chip">Forty seconds of slow work</span>
<span class="reel__chip reel__time">0:00</span>
</p>
</section>
<style>
.reel {
padding: var(--space-xl) clamp(var(--edge), 16vw, 15rem) var(--section-space);
font-family: var(--font-body);
font-weight: var(--weight-bold);
transition: padding var(--pad) var(--ease);
}
.reel.is-playing {
padding-left: var(--edge);
padding-right: var(--edge);
}
.reel__frame {
position: relative;
aspect-ratio: 16 / 9;
overflow: hidden;
border-radius: var(--radius-l);
background: var(--chip-solid);
}
.reel__img {
width: 100%;
height: 100%;
object-fit: cover;
transform-origin: 30% 60%;
transform: scale(calc(1 + var(--pan, 0) * 0.14));
}
.reel__bar {
position: absolute;
left: 0;
right: 0;
bottom: 0;
height: calc(var(--line) * 2);
background: var(--chip);
}
.reel__progress {
display: block;
width: 100%;
height: 100%;
background: var(--ink);
transform-origin: 0 50%;
transform: scaleX(var(--pan, 0));
}
.reel__controls {
position: absolute;
top: var(--space-s);
right: var(--space-s);
display: flex;
gap: var(--chip-gap);
}
.reel__button {
min-width: var(--tap);
min-height: var(--tap);
padding: 0 var(--space-m);
border: 0;
border-radius: var(--radius);
background: var(--chip);
backdrop-filter: blur(var(--blur));
color: var(--ink);
font: inherit;
font-size: var(--text-m);
cursor: pointer;
transition: background-color var(--fast) var(--ease), transform var(--fast) var(--ease-press);
}
.reel__button:hover {
background: var(--paper);
}
.reel__button:active {
transform: scale(0.96);
}
.reel__button:focus-visible {
outline: var(--line) solid var(--ink);
outline-offset: 2px;
}
.reel__button[aria-pressed="true"] {
background: var(--mint);
}
.reel__caption {
display: flex;
flex-wrap: wrap;
gap: var(--chip-gap);
margin: var(--space-s) 0 0;
font-size: var(--text-s);
}
.reel__chip {
padding: var(--space-xs) var(--space-s);
border-radius: var(--radius);
background: var(--chip);
}
.reel__chip--title {
background: var(--periwinkle);
}
.reel__time {
font-variant-numeric: tabular-nums;
}
@media (prefers-reduced-motion: reduce) {
.reel__img { transform: none; }
}
</style>
<script>
(() => {
const LENGTH = 40000;
for (const root of document.querySelectorAll('.reel')) {
const play = root.querySelector('.reel__button--play');
const mute = root.querySelector('.reel__button--mute');
const time = root.querySelector('.reel__time');
let playing = false;
let visible = true;
let elapsed = 0;
let last = 0;
let frame = 0;
const draw = () => {
root.style.setProperty('--pan', (elapsed / LENGTH).toFixed(4));
const seconds = Math.floor(elapsed / 1000);
time.textContent = `0:${String(seconds).padStart(2, '0')}`;
};
const tick = (now) => {
elapsed = (elapsed + (now - last)) % LENGTH;
last = now;
draw();
frame = requestAnimationFrame(tick);
};
const run = () => {
cancelAnimationFrame(frame);
if (playing && visible && !document.hidden) {
last = performance.now();
frame = requestAnimationFrame(tick);
}
};
play.addEventListener('click', () => {
playing = !playing;
root.classList.toggle('is-playing', playing);
play.setAttribute('aria-pressed', String(playing));
play.textContent = playing ? 'Pause' : 'Play';
run();
});
mute.addEventListener('click', () => {
const muted = mute.getAttribute('aria-pressed') !== 'true';
mute.setAttribute('aria-pressed', String(muted));
mute.textContent = muted ? 'Sound on' : 'Mute';
});
new IntersectionObserver(([entry]) => { visible = entry.isIntersecting; run(); }).observe(root);
document.addEventListener('visibilitychange', run);
draw();
}
})();
</script>