A 5 x 5 block city of shear buildings, each an oscillator with its own natural period. Shake it and see which heights resonate.
-Peak ground accel. (PGA)
-Resonant height at this frequency
-Selected building
-Natural period T = 0.1 N
-Dynamic amplification D
-Damping ratio zeta
-Roof displacement now
-Peak drift ratio / collapse limit
-Damage state
-Elapsed
-Frames per second
-Dust / debris particles
The science
Each building is modelled as one mass on a spring, a single-degree-of-freedom oscillator. With roof displacement u relative to the ground it obeys u'' + 2 zeta w_n u' + w_n^2 u = -a_g(t), where a_g is the ground acceleration and w_n = 2 pi / T. An engineering rule of thumb gives the natural period T = 0.1 N seconds for N storeys, so tall buildings sway slowly and low ones quickly.
For harmonic shaking at frequency f the steady response is u = (A / w_n^2) D with the dynamic amplification D = 1 / sqrt((1 - r^2)^2 + (2 zeta r)^2), r = f / f_n. At resonance (r = 1) D = 1/(2 zeta), which is why a lightly damped building of the matching height is far more vulnerable than its neighbours. The peak ground acceleration here follows an illustrative law that doubles per magnitude unit, PGA = 0.006 g * 2^(Mw - 3), capped at 1.6 g. A building collapses when its drift ratio |u| / H exceeds a limit that rises with code strength (0.35 % to 2.15 %), and the damage state ladder (slight, moderate, extensive, collapse) is read from that ratio.
Honest simplifications: one horizontal direction only; a linear mode shape (displacement grows linearly with height); no soil amplification, no torsion, no real accelerograms or magnitude-distance attenuation; real structures yield and soften before they fail, here damage is read from the peak elastic drift. The sway you see is multiplied by the exaggeration slider, because a real 4 cm roof movement would be invisible; all readouts are the true, un-exaggerated values. Collapse is shown as a pancake of the storeys above the weakest (second) storey for visual effect, not a structural collapse simulation. Educational model on inanimate buildings, not a seismic design or risk tool.