Drifting frames
A slow endless row of small framed pictures, tilted a little each way, that stops when the pointer rests on it.
Part of the style
Pastel Wave Snapshots
7 parts that belong together, with their tokens, type and rules.
https://kitbash.me/components/pastel-wave-snapshots/drift/figma.html?palette=4febc8d23e2096d2
Use the Figma MCP server (https://mcp.figma.com/mcp). Download https://kitbash.me/components/pastel-wave-snapshots/drift/figma.html?palette=4febc8d23e2096d2 and pass that whole HTML document to the html_to_figma tool, so the part "Drifting frames" 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 {
--ink: #000000;
--ink-soft: #1d1713;
--frame: #ffffff;
--paper: #f6f6f6;
--dot: rgba(78, 72, 69, 0.349);
--scrim: rgba(0, 0, 0, 0.851);
--shadow-ink: rgba(0, 0, 0, 0.149);
--link: #8a6a50;
--link-deep: #87674e;
--ribbon-blue: #836b5d;
--ribbon-teal: #a3846c;
--ribbon-cream: #a38267;
--ribbon-pink: #836b5d;
}
</style>
<section class="drift" aria-label="Recently added">
<p class="drift__label"><b class="drift__count">142</b> pictures so far, newest first</p>
<div class="drift__window">
<ul class="drift__track">
<li class="drift__item"><img class="drift__photo" src="assets/woman-on-beach.jpg" alt="A woman in white at the shore at night" width="556" height="800"></li>
<li class="drift__item"><img class="drift__photo" src="assets/seascape.jpg" alt="Blue waves breaking under a stormy sky" width="800" height="631"></li>
<li class="drift__item"><img class="drift__photo" src="assets/children-berneval.jpg" alt="Children sketched on a beach" width="507" height="800"></li>
<li class="drift__item"><img class="drift__photo" src="assets/promenade.jpg" alt="A crowd strolling under trees" width="800" height="596"></li>
<li class="drift__item"><img class="drift__photo" src="assets/in-the-sea.jpg" alt="Figures playing in shallow sea water" width="800" height="603"></li>
<li class="drift__item"><img class="drift__photo" src="assets/york-harbor.jpg" alt="A misty harbour with two boats" width="800" height="400"></li>
<li class="drift__item"><img class="drift__photo" src="assets/beach-sainte-adresse.jpg" alt="A pebbly beach with boats" width="800" height="591"></li>
</ul>
</div>
</section>
<style>
.drift {
padding: var(--section-space) 0;
text-align: center;
}
.drift__label {
margin: 0 var(--edge) var(--space-l);
font-size: var(--text-s);
font-style: italic;
font-weight: 700;
}
.drift__count {
display: block;
color: var(--ink);
font-size: var(--display);
font-style: normal;
font-weight: 800;
line-height: var(--display-leading);
letter-spacing: var(--display-track);
}
.drift__window {
overflow: hidden;
padding: var(--space-l) 0;
}
.drift__track {
display: flex;
width: max-content;
margin: 0;
padding: 0;
list-style: none;
animation: drift-roll 48s linear infinite;
}
.drift__window:hover .drift__track { animation-play-state: paused; }
.drift__item {
flex: none;
margin-right: var(--space-l);
padding: var(--frame-pad);
border-radius: var(--radius-frame);
background: var(--frame);
box-shadow: var(--shadow);
rotate: -3deg;
transition: rotate var(--quick) var(--ease), scale var(--quick) var(--ease);
}
.drift__item:nth-child(even) { rotate: 2.5deg; translate: 0 10px; }
.drift__item:nth-child(3n) { rotate: -1deg; }
.drift__item:hover { rotate: 0deg; scale: 1.06; }
.drift__photo {
width: clamp(120px, 16vw, 190px);
height: auto;
aspect-ratio: 4 / 5;
object-fit: cover;
border-radius: var(--radius-photo);
}
@keyframes drift-roll { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
.drift__track { animation: none; }
}
</style>
<script>
(() => {
for (const track of document.querySelectorAll('.drift__track')) {
for (const item of [...track.children]) {
const copy = item.cloneNode(true);
copy.setAttribute('aria-hidden', 'true');
track.append(copy);
}
}
})();
</script>