← 🎠 Magic Around Us
🟢 5–8 years

🫧 Soap bubbles

Popped: 0 🫧
💡 Why round?
A bubble is always round — a sphere has the smallest possible surface area for a given volume of air!
Click — new bubble · Click on bubble — Pop!

🫧 Soap Bubbles — Surface Tension

Iridescent soap bubbles float and collide with realistic thin-film interference colours. Surface tension keeps them spherical while air resistance slows their drift.

🔬 What It Demonstrates

Thin-film interference creates rainbow colours as light reflects off the inner and outer surfaces of the soap film, with phase shifts creating constructive and destructive interference.

🎮 How to Use

Click to create new bubbles. Watch them interact, merge or pop. The colour patterns shift as the film thickness changes.

💡 Did You Know?

A soap bubble is the minimal surface enclosing a given volume. This is why bubbles are always spherical — a sphere has the least surface area for any volume.

About Soap Bubbles

This simulation shows soap bubbles governed by surface tension, the force that pulls a thin liquid film into the smallest possible shape. Each bubble is a 2D circle with position, velocity, hue and a finite lifetime, drawn with a radial gradient and a specular highlight to mimic thin-film iridescence. Every frame, wind and gravity are added to its velocity before air drag is applied, and a pairwise pass separates overlapping bubbles and exchanges momentum.

The Size slider sets the radius of new bubbles, Wind applies a horizontal push (negative left, positive right), and Gravity sets a vertical force where negative values make bubbles float upward. The bubble machine streams bubbles automatically, "Blow all away" clears the screen, and clicking either spawns or pops a bubble. The same minimal-surface mathematics that keeps bubbles spherical guides foams, lightweight roof structures and tensioned-fabric architecture.

Frequently Asked Questions

What does this simulation show?

It shows soap bubbles that drift, bounce off walls, collide with their neighbours and eventually pop into a shower of coloured particles. Each bubble is rendered with a radial gradient to suggest the iridescent sheen of a real thin soap film.

Why are real soap bubbles always round?

Surface tension pulls the film inward until it reaches the smallest possible surface area for the air trapped inside. A sphere is the unique shape that minimises surface area for a fixed volume, so a free bubble settles into a sphere.

What do the three sliders do?

Size sets the radius of newly created bubbles, Wind applies a horizontal push that blows left for negative values and right for positive ones, and Gravity sets the vertical force. Because soap bubbles are lighter than air, a slightly negative gravity makes them float upward by default.

How do I create and pop bubbles?

Click on empty space to spawn a bubble, or click directly on an existing bubble to pop it. The "Bubble machine" button toggles an automatic stream rising from the bottom, while "Blow all away" instantly clears every bubble on screen.

What is the key equation behind a soap bubble?

The Laplace pressure inside a soap bubble is P = 4 * gamma / r, where gamma is the surface tension of the film and r is the radius. The factor of four arises because a bubble has two surfaces (inner and outer); a single liquid surface gives P = 2 * gamma / r. Smaller bubbles squeeze the air harder.

How does the collision handling work?

Each frame, a pairwise loop checks every pair of living bubbles. When two overlap, they are pushed apart along the line joining their centres, and the component of their relative velocity along that line is partly exchanged. This makes the bubbles jostle and nudge each other rather than passing through.

Why do the bubbles show rainbow colours?

In reality, light reflects from both the inner and outer surfaces of the soap film; the two reflections interfere, and the colour that survives depends on the film thickness. This thin-film interference produces the shifting iridescence. The simulation approximates the effect using hue-shifted radial gradients rather than computing true optical interference.

Is the physics in this simulation accurate?

It is a stylised, qualitative model rather than a precise simulation. Motion, wind, gravity, drag and elastic-style collisions behave plausibly, but the colours are an artistic approximation and the bubbles never truly merge or form the flat shared walls that real touching bubbles create.

What happens when a bubble pops?

A bubble pops when it reaches the ceiling or exceeds its random maximum age, typically between 300 and 900 frames. Popping spawns an expanding coloured ring and a burst of small particles that fade out under their own gravity, accompanied by a short synthesised "pop" sound.

Where does bubble mathematics appear in the real world?

Minimal surfaces and surface tension appear throughout science and design: in foams and froths, in tensioned-fabric roofs and tents, in the shape of liquid droplets, and in Plateau's laws describing how soap films meet. Joseph Plateau showed that three films always join at exactly 120 degrees, nature solving a minimisation problem instantly.