How it works
The bubble chart's encoding is simple: one circle per category, radius mapping magnitude, positioned by category or by two metrics. The tap interaction chains three motions: the chosen bubble scales up (capped near 1.7x) and travels to the canvas center; every other bubble computes an avoidance offset by distance from the mover - close ones pushed far, distant ones barely - iterated two or three rounds until nothing overlaps; all of it transitions over 0.4 seconds on a spring curve, like a bead pressed into water shoving its neighbors aside.
The structural key: put translation on the g element's transform and scaling on the circle with transform-box: fill-box so the scale anchors at the bubble's own center. The two layers cascade without fighting each other. The avoidance pass is a tiny O(n squared) relaxation - trivial for a dozen bubbles, still sub-millisecond for dozens.
How to use this prompt
For compositions with many categories and wild value spreads: content types, traffic channels, inventory. Provide names, values, and an optional second dimension; the AI builds radius mapping and the avoidance solver. When small bubbles cannot fit their labels, instruct: bubbles under 14px radius place their label below the circle.
Tips for better results
Map radius to area, not value - r proportional to the square root of v - or big numbers visually dwarf reality. Tapping the enlarged bubble must restore the layout; both states need a clean exit. Keep all bubbles one hue at varied lightness and give the centered one an outline for emphasis. Fade pushed-aside bubbles slightly with distance for instant depth. And honor prefers-reduced-motion: jump straight to the final state, skipping the push animation entirely.