Lava Lamp | PhysicsJS

This is an advanced PhysicsJS example. Here's the code.

The scene is setup with circles that are given a "temperature" parameter that controls their buoyancy (vertical acceleration) with a custom buoyancy behavior.

A custom radiation behavior calculates the heat radiated and absorbed by each of the blobs. This is modeled as Black-body Radiation.

A large, fixed, hidden circle (with a high heat capacity) is placed just below the canvas. It acts as the "lamp" that heats up the blobs

The "blob" effect is created by a custom "metaball" renderer.