← Case study

Detail 08 · Interaction

Dynamic islands

Islands instead of a menu: pills that spring, squish and blur open in place, sketched icons, six islands from one kit, and the textbook fix that measured slower. 9 minutes, 2 demos.

Try it: open the island

01 · The idea

No menu, just islands

This site has very few places to go: home, my case studies, my writing, my résumé, ways to reach me, plus some music and a few settings. A menu would hide those few things behind a click, and a row of text links would make the header look like every other portfolio.

So each one is an island: a small pill that opens in place into what it holds, the way the iPhone’s Dynamic Island grows out of the top of the screen. The logo is the way home. The pills already show what’s inside them, as tiny pencil sketches, so you know what you’ll get before you open one.

The places sit in a dock in the middle of the header: Crafts, Writing, social, résumé. The music and the settings sit in its far corner. Only one dock island is open at a time; the others tuck away so the open one stays centred. On phones the dock moves to the bottom of the screen, within reach of a thumb, and the islands open upwards. So all four fit across a phone, and beside the logo on a tablet, the social pill shows three of its six logos there; opened, it shows them all.

02 · Play with it

The island, taken apart

Below is the social island, built from the same kit as the real one and with its parts on switches. Open and close it at the live speed first, then slow it down and switch things off one at a time.

The island, taken apart
Speed

Five things make the morph feel like one object changing shape rather than a box being resized:

  • A spring with a little give. It settles with a soft overshoot instead of stopping dead, so the pill feels like it has weight. Opening has more give than closing, and closing is quicker, 0.3 seconds against 0.42: a close answers a click elsewhere or Esc, and a shrinking pill that wobbles looks unsure of itself.
  • A squish. As it opens, the island stretches a little taller and narrower, and as it closes it squashes, then wobbles back to true, all from its fixed edge, so that edge never moves.
  • A blur through the middle. The island blurs as it starts to change and sharpens as it settles, which hides the in-between frames where nothing is quite one shape or the other.
  • Content that waits. The pill’s icons fade out at once; the open content fades in a beat later, once there’s room for it.
  • Content anchored at full size. The open content is laid out at its final size and pinned to the island’s top edge from the first frame. The growing island uncovers it, so nothing inside is ever squeezed or reflowed.

03 · How it’s built

One kit, six islands

Every island is built from the same few pieces, so they line up and move alike: one spring, one pill size, one shadow, one outline, one hover. A closed pill swells a little under the pointer, in CSS, and the same with animations on or off: it’s the island answering you, not motion for show.

The spring, and a pill sized by its icons
// Smooth with a gentle settle, like the iPhone's Dynamic Island: the site's morph, a touch quicker
// (an island is small and opened often: at the morph's own pace it felt slow to answer)
export const ISLAND_SPRING = { ...SPRING.morph, visualDuration: 0.42 };
// Opening has more give: it overshoots further and springs back, the squishy part of the
// morph. Closing tucks away on the calmer one (a shrinking pill that wobbles looks unsure)
export const islandSpring = (isOpen) => (isOpen ? { ...ISLAND_SPRING, bounce: 0.35 } : ISLAND_CLOSE);
// Closing answers a click elsewhere or Esc, so it's quicker than opening
export const ISLAND_CLOSE = { ...ISLAND_SPRING, visualDuration: 0.3 };

/**
 * An island's own CSS: a closed pill swells a little on hover (clicking opens it), the same in
 * every mode (`interact`), with the shadow's fade as it opens (`islandShadow`). `transform`, not
 * `scale`: that's the squish's (`useMorphBlur`).
 */
export const islandHover = (isOpen) =>
  `interact [transition:box-shadow_500ms_var(--ease-out),transform_150ms_var(--ease-out)] ${isOpen ? "" : "hover:[transform:scale(1.05)]"}`;
// The swell's timing, for a demo that plays it with motion
export const HOVER = { duration: 0.15, ease: EASE.out };

/*
  The closed pill, the same for every island so they line up in the dock:
  one height, one icon size and gap, and side padding of half the height, so
  the first and last icons sit where the rounded ends begin.
*/
export const PILL = { height: 36, icon: 14, gap: 12 };

// A one-icon pill's sketch (crafts, résumé, settings): bright and a little heavy, as it's the
// only thing saying what the pill is (thin and 60% white, it was hard to make out; it keeps the
// social icons' slight resting blur); whiter still under the pointer or keyboard focus
export const PILL_ICON = "interact text-white/85 transition-colors hover:text-white focus-visible:text-white";
export const PILL_ICON_STROKE = 1.5;

/** An island's closed size, from how many icons it shows. */
export const pillSize = (icons) => ({
  width: PILL.height + icons * PILL.icon + (icons - 1) * PILL.gap,
  height: PILL.height,
  borderRadius: PILL.height / 2,
});

The blur is a keyframe animation on the island itself, played on every change of open state except the first render. The squish beside it took one more step. It has no destination, only a kick: it starts at rest and ends at rest, moved by a starting speed alone. But Motion ignores a starting speed on a spring set by its duration, so the playful spring is worked out as stiffness and damping instead. And it’s the CSS scale property, apart from the transform the hover writes, so the two never fight.

Blurring through the morph
// The island blurs mid-morph and sharpens as it settles, like the Dynamic Island
export const MORPH_BLUR = { filter: ["blur(0px)", "blur(8px)", "blur(0px)"] };
export const MORPH_BLUR_TIMING = { duration: ISLAND_SPRING.visualDuration, times: [0, 0.3, 1], ease: "easeOut" };

/*
  ...and it gives, like something soft: kicked at the start and left to the playful spring,
  opening draws it out the way it grows (taller, a touch narrower) and closing squashes it,
  then it wobbles back to true. How far each axis goes, at the kick's peak. It's the CSS
  `scale` property, apart from the `transform` motion writes (the hover's swell), and works
  from the island's fixed edge (its transform origin), so that edge never moves
*/
export const MORPH_SQUISH = { open: { x: -0.03, y: 0.06 }, close: { x: 0.02, y: -0.04 } };

// The playful spring as stiffness and damping, worked out as motion does: a spring set by its
// duration ignores a starting speed, and a kick is all this one has
const PLAYFUL_PHYSICS = (() => {
  const { visualDuration, bounce } = SPRING.playful;
  const stiffness = ((2 * Math.PI) / (visualDuration * 1.2)) ** 2;
  return { type: "spring", stiffness, damping: 2 * (1 - bounce) * Math.sqrt(stiffness) };
})();
// The starting speed that peaks at 1
const SQUISH_KICK = 30;

/**
 * Squishes `element` from its fixed edge (its transform origin) and lets it wobble back to true.
 * `pace` slows it (a demo's speed: 2 takes twice as long). Returns what stops it.
 */
export function squish(element, isOpen, { animate = motionAnimate, pace = 1 } = {}) {
  const { x, y } = isOpen ? MORPH_SQUISH.open : MORPH_SQUISH.close;
  const set = (amount) => (element.style.scale = amount ? `${1 + amount * x} ${1 + amount * y}` : "");
  // From rest to rest, moved only by its starting speed
  const wobble = animate(0, 0, {
    ...PLAYFUL_PHYSICS,
    stiffness: PLAYFUL_PHYSICS.stiffness / pace ** 2,
    damping: PLAYFUL_PHYSICS.damping / pace,
    velocity: SQUISH_KICK / pace,
    onUpdate: set,
    onComplete: () => set(0),
  });
  return {
    stop: () => {
      wobble.stop();
      set(0);
    },
  };
}

/** Blurs `ref`'s element through each open/close morph and squishes it (not on first render). */
export function useMorphBlur(ref, isOpen) {
  // With animations off, both land at once
  const animate = useAnimator();
  // Read when a morph starts, not a reason to start one: as a dependency, switching animations
  // off in the settings blurred every island at once, none of them opening or closing
  const reduceMotion = useReducedMotion();
  const reduceMotionRef = useRef(reduceMotion);
  useEffect(() => {
    reduceMotionRef.current = reduceMotion;
  }, [reduceMotion]);
  const hasMountedRef = useRef(false);
  useEffect(() => {
    if (!hasMountedRef.current) {
      hasMountedRef.current = true;
      return;
    }
    const element = ref.current;
    const controls = [animate(element, MORPH_BLUR, { ...MORPH_BLUR_TIMING, duration: islandSpring(isOpen).visualDuration })];
    // The calm version only blurs: the squish is motion for its own sake
    if (!reduceMotionRef.current) controls.push(squish(element, isOpen, { animate }));
    return () => controls.forEach((control) => control.stop());
  }, [ref, isOpen, animate]);
}

The dock holds which island is open. The others shrink to nothing and fade, on the same spring, so the open one slides to the centre rather than jumping there.

One island open at a time
const slot = (name, island, gapBefore = 0) => {
  const hidden = isHidden(name);
  return (
    <motion.div
      initial={false}
      animate={{
        width: hidden ? 0 : "auto",
        marginLeft: allShown ? gapBefore : 0,
        opacity: hidden ? 0 : 1,
        scale: hidden ? 0.9 : 1,
      }}
      // Coming back as the open one closes, at its pace
      transition={allShown ? ISLAND_CLOSE : ISLAND_SPRING}
      inert={hidden}

A hidden island is also inert, so a keyboard can’t tab into something you can’t see.

04 · Two ways to grow

The textbook fix that measured slower

An island grows by changing its real width and height, every frame of the morph. That’s the textbook thing not to do: a size change means the browser lays the island out again and redraws it at every size, its blur, its shadow and its pencil-roughened outline included. Counted, an island opening and closing runs at about 41 frames a second, against 60 with nothing moving. So I tried the two fixes the books suggest.

The first dropped the costly effects only while the island moved, and brought them back as it settled. The frame rate barely moved, and something worse showed up: without its backdrop blur, the island’s 90% background let the page behind it show through for a moment, the name on the home page plainly readable mid-morph.

The second is the one every guide recommends. Lay the island out once at its full size and uncover it with a clip, so its shape changes without anything being laid out again. It measured slower: about 36 frames a second against 41. The clip also lagged the island’s edge by a frame on the way closed, and stayed stuck on the pill after it shut. Both went back out, and the islands grow the way they always did.

The time goes into drawing: the island’s pencil filters, its two blurs and its shadow, together. With every one of them off, the morph ran at 58 frames a second, but no single one was the cost, and neither fix changed how much there is to draw. The textbook fix is a guess about where the time goes; only counting the frames says whether it’s right. How they were counted is in the performance detail.

05 · The icons

Sketches that colour in

The icons are the real brand logos, drawn as pencil sketches. Each logo’s outline is traced twice through two different noise filters, so the two passes drift apart the way a quick sketch goes over its lines. Point at one and it colours in from the bottom, like filling it in with a marker, while the pencil fades.

Sketches that colour in

Let's connect

The colouring is a mask on the real logo: a gradient band with a soft top edge, rising as a motion value goes from 0 to 1. It never re-renders the component; only the mask moves.

A soft-edged band of colour, rising
// A soft-edged band of color rises from below the icon to above it
const inkTop = useTransform(fill, (p) => p * (100 + INK_EDGE));
const inkSolid = useTransform(inkTop, (top) => top - INK_EDGE);
const inkMask = useMotionTemplate`linear-gradient(to top, #000 ${inkSolid}%, transparent ${inkTop}%)`;
const sketchOpacity = useTransform(fill, [0, 0.6, 1], [1, 0.6, 0]);

06 · The others

Crafts, Writing, the music, the résumé and the settings

The Crafts island comes first in the dock. It opens on the case study’s book, lying closed, and a click carries the book itself to the case study’s page.

The Writing island comes next, a pencil writing a line, and opens the way Crafts does: the latest article as its printed page, its title beside it, and the way to the rest.

The music island sits in the navbar, not the dock, but it’s built the same way. It’s pinned at its top-right corner and grows left and down around its waveform, which never moves, so it opens without the wave jumping. The wave swells with each beat of the music. A click opens it, as the dock’s islands open, with its close in the wave’s place; it also opens once by itself just after the intro to offer a song, then tucks away unless it’s been used. Open, it’s a small music player: previous, play/pause and next, the play ⇄ pause the same hand-drawn shape as the demos’ play buttons, and skipping fades the old track out rather than cutting it. The pencil rule above the controls is the progress bar: an ember wave grows along it as the song plays, flowing with the island’s wave; paused, it turns gray and lies flat, so it can’t be mistaken for the rule.

The résumé island opens to a thumbnail of the real résumé: the same coded component as the résumé page, not a picture of it. Click it and the thumbnail is carried, whole, to the full page, which has a detail of its own later in this case study.

The settings island sits beside the music, opening from the same corner: three switches, for the animations, the page transitions and the sound. It has a detail of its own too.

07 · Decisions

Why it’s built this way

Show what's inside

A closed pill shows sketches of what it holds. You never open something to find out what it is.

Open in place

Links, a résumé preview, a song: each is a glance, so none of them costs a page change.

One open at a time

Opening one island tucks the others away. The dock never turns into a pile of panels.

One kit for all

Same pill height, same spring, same outline. They line up and move alike because they’re built from the same parts.

08 · Takeaways

What to keep

  • If a site has few destinations, show them; let each open in place instead of hiding them in a menu.
  • A morph reads as one object when it springs, squishes, blurs through the middle, and uncovers content laid out at its final size. Close quicker than you open.
  • Measure the textbook fix before you ship it: here it was slower.
  • Build every island from one shared kit, so they line up and move alike.
The real dock→

The islands are at the top of every page, this one included. On the home page, the music island opens by itself after the intro.