Source. Solar-wind electrons accelerated along magnetic field lines hit the upper atmosphere at 1-30 keV and excite oxygen and nitrogen. Each line has its own photon energy E = hc/λ (hc = 1239.84 eV nm): 557.7 nm green O(1S→1D), 630.0 nm red O(1D→3P), 427.8 nm violet-blue N2+.
Height of the curtain. An electron of energy E stops where the atmospheric column mass equals its range, R = 4.57×10-6 E1.75 g/cm2 (Grün, E in keV). The atmosphere is a simplified model: ρ(100 km) = 5.6×10-10 g/cm3, scale height H(z) = 5.8 + 0.15 (z-100) km. Higher energy: deeper, lower curtain.
Colour and flicker. The green line has a radiative lifetime of 0.74 s, so green structure changes in about a second; the red O(1D) state lives about 110 s and is seen only high up, where collisions are rare. An observer sees height h out to the line-of-sight distance √(2REh + h2), about 1180 km for 110 km.
Honest simplifications. Real electron spectra are broad, the stopping altitude only estimates the emission peak, the model drops the dH/dz term and ignores day-to-day atmosphere changes. The animated curtains are an artistic noise field, not a magnetohydrodynamic calculation. The landscape is a toy-scale diorama.
Numerical checks (run live in your browser):