Skip to content
Founding Lifetime: every Pro skillfirst 100 members · $169 onceUpgrade
Lookbk
Sign In
Effect guide

Iridescent effect with thin-film interference

The rainbow shimmer of a soap bubble or an oil slick, worked out from how light bounces in a very thin film. How thin-film iridescence works, a starter that paints it, and the skill that builds an iridescent bubble hero.

Free skills to start. Pro is $79 a year for every skill, or $9.99 a month for 10. See pricing

What is a thin-film iridescence?

Thin-film interference is why a soap bubble, an oil slick or a beetle shell shows bands of shifting color. Light reflects off both the top and the bottom of a film only a few hundred nanometers thick. The two reflections overlap and, depending on the film’s thickness, some colors cancel out and others reinforce, so the surface shows the colors that survive.

Because the color depends on thickness and on the angle you look from, it swirls as the film moves and drains. That is what makes real iridescence feel alive, and why a static rainbow gradient never looks quite right. It suits beauty, skincare, fashion, music and anything that wants to feel precious or futuristic.

How the effect works

For a film of thickness d and refractive index n, the two reflections differ in path by 2 × n × d (straight on). Light of wavelength λ comes out strongest when that difference, plus the half-wave flip at the top surface, is a whole number of wavelengths. Working out the strength for a red, a green and a blue wavelength gives an RGB color for any thickness.

Then vary the thickness across the surface: thinner at the top of a bubble, where it drains, thicker at the bottom, with some slow swirl. Map each pixel’s thickness to its interference color and the familiar magenta, blue, green and gold bands appear on their own.

  1. 01

    Pick three wavelengths

    Around 650 nm for red, 532 nm for green and 450 nm for blue.

  2. 02

    Compute the reflection

    Strength = sin²(2π × n × d / λ) for each, with n about 1.33 for soapy water.

  3. 03

    Vary the thickness

    Sweep d from roughly 100 to 900 nm across the surface and add slow noise so the bands swirl.

  4. 04

    Add highlights

    A reflected window and a pin highlight make it read as a glossy bubble, not a gradient.

HTML

Thin-film colors painted on a canvas

Paints a disc whose color comes from thin-film interference at three wavelengths, with the thickness swirling over time. It renders small and scales up with CSS to stay fast.

<canvas id="film" width="240" height="240" style="width:360px;height:360px;border-radius:50%;background:#0d0d12"></canvas>
<script>
const canvas = document.getElementById('film')
const g = canvas.getContext('2d')
const W = canvas.width, img = g.createImageData(W, W)
const N = 1.33, WAVES = [650, 532, 450] // nm: red, green, blue
const still = matchMedia('(prefers-reduced-motion: reduce)').matches
function film(d) {
  return WAVES.map((l) => Math.sin((2 * Math.PI * N * d) / l) ** 2)
}
function frame(t) {
  const s = still ? 0 : t / 1000
  for (let y = 0; y < W; y++) for (let x = 0; x < W; x++) {
    const u = x / W - 0.5, v = y / W - 0.5, r = Math.hypot(u, v)
    const i = (y * W + x) * 4
    if (r > 0.5) { img.data[i + 3] = 0; continue }
    // Thin at the top, thick at the bottom, with a slow swirl.
    const swirl = Math.sin(u * 9 + s * 0.7) * Math.cos(v * 7 - s * 0.5)
    const d = 150 + (v + 0.5) * 650 + swirl * 120
    const [cr, cg, cb] = film(d)
    const rim = Math.min(1, 0.25 + r * 1.6) // the film shows most at the edge
    img.data[i] = cr * 255 * rim
    img.data[i + 1] = cg * 255 * rim
    img.data[i + 2] = cb * 255 * rim
    img.data[i + 3] = 255
  }
  g.putImageData(img, 0, 0)
  if (!still) requestAnimationFrame(frame)
}
requestAnimationFrame(frame)
</script>

A starting point written for this page, free to use in your own projects. The skills below build the finished version with checks, fallbacks and a recorded video.

What to get right on a real page

  1. 01

    Keep it mostly clear

    A real bubble is transparent with color at the rim and in bands. Solid rainbow fill looks like a gradient sticker.

  2. 02

    Move the color, not the shape

    Slow drifting bands sell the film. A bubble that bounces around fast hides the effect.

  3. 03

    Use a dark background

    Interference colors are reflections; they glow on ink, navy or black and wash out on white.

  4. 04

    Show one finished frame for reduced motion

    Respect prefers-reduced-motion: show one finished frame instead of the loop. A visitor who turned motion off still gets the look.

Skills that build a thin-film iridescence

A finished hero of iridescent bubbles beside your headline, with your colors, fonts, logo and words, and a seamless 1080p loop.

  1. Soap Bubble Hero: an example of what it makes
    web
    Soap Bubble HeroClaude CodeCodexCursor+3 more agents

    Motion Heroes · Pro

    Soap Bubble Hero

    Animated WebGL hero · page + embed + 1080p video

    One large bubble wobbles as its film turns while smaller ones rise, drift in front and behind, drain thin and gold at the top and pop with a bright rim and a ring of droplets. The colors are real thin-film interference summed over eight wavelengths from the film’s thickness and the viewing angle, with a reflected window, a pin highlight and out-of-focus bubbles behind.

    Worth knowing: The live hero needs WebGL; bubbles follow set paths and do not react to the cursor.

    Needs: Node.js 18+, Chrome (or Chromium/Edge), and ffmpeg for the video

    See what Soap Bubble Hero makes

Install

Build a thin-film iridescence with your agent

Each skill is a SKILL.md folder, so it installs the same way in Claude Code, Codex, Cursor and other agents. The example below uses Soap Bubble Hero; each skill page has its own prompt.

1. Paste the install prompt

Your agent runs the installer. The first time, it shows a sign-in link so you can approve it in the browser.

Install the "Soap Bubble Hero" skill from Lookbk (https://lookbk.dev/skills/soap-bubble-hero).
1. Run: curl -fsSL https://lookbk.dev/cli.js | node - add soap-bubble-hero
2. If it prints a sign-in link, show it to me. When I say I approved it, run the same command again.
3. When the install finishes, read the SKILL.md it installed and tell me what you need from me to make the first result.

Or run it in a terminal

curl -fsSL https://lookbk.dev/cli.js | node - add soap-bubble-hero

2. Start a new session

Agents load skills when a session starts. The installer writes the folder where your agent looks:

Claude Code
~/.claude/skills/soap-bubble-hero
Codex
~/.agents/skills/soap-bubble-hero
Cursor
~/.agents/skills/soap-bubble-hero

3. Ask for the result

Describe it in plain words, for example:

Build a Soap Bubble hero for Pellicle, a skincare serum: deep ink background, blush pink accent, rich iridescent bubbles, headline 'Skin that catches the light.', and record a 12-second loop.

Another agent? Install a skill in any agent

FAQ

Questions

Still stuck? The guides cover installing, agents and licensing in more detail.

Read the guides
How do I make an iridescent effect in CSS?

A conic-gradient of magenta, blue, green and gold with mix-blend-mode: color-dodge or overlay on a dark surface, slowly rotated, gets close for buttons and cards. True thin-film color that depends on thickness needs canvas or a shader.

What is the difference between iridescent and holographic?

Iridescence is color from interference in a thin layer, as in bubbles and shells. Holographic foil usually means a diffraction grating that splits light into a sharper rainbow. They look similar but holographic bands are crisper and more regular.

Why does a soap bubble turn gold and then black before it pops?

The film drains and gets thinner at the top. As it thins, the colors shift toward gold, and once it is much thinner than the wavelength of light both reflections cancel and the top looks black just before it bursts.

Can I get the bubble hero as a video?

Yes. Soap Bubble Hero records a seamless 1080p loop for launch posts and places where scripts are not allowed.