Each metaball is a point radiating influence that falls off with distance. Sum the fields of every ball and draw the surface where the total crosses a threshold: where balls are far apart they render as separate spheres, and as they approach, their fields add up and the surfaces reach for each other, neck, and merge into one liquid mass. Pull them apart and the blob strains and splits with a satisfying snap. Jim Blinn invented the technique in the early 1980s to render molecules.
The mercury behavior is free; it falls out of the math rather than being animated. That made metaballs a fixture of the demoscene and of every era’s liquid-effect toolbox, whether rendered as 2D isolines, marching-cubes meshes, or raymarched smooth-minimum blends, which are the modern SDF descendant of the same idea.
For music the mapping is almost too natural: balls as voices or bands, size from energy, and the merging does the expressive work. A bassline swelling until the whole mass fuses, then a break scattering it into droplets, is structure you can hear with your eyes. The lava-lamp gene runs straight back through liquid light shows to the oldest music visuals there are.