Shows a set of sample values on a number line with the mean bc marked. For each sample it draws the deviation (X-bc) and a corresponding squared-deviation bar, illustrating variance as E[(X-bc)^2]. The right panel animates a linear transform Y=aX+b and compares measured Var(Y) against the rule Var(aX+b)=a^2Var(X), while also showing c3=sqrt(Var).
Deterministic pseudo-random samples are generated once and reused. Animation cycles every ~4s, smoothly adjusting a and b; an active sample index steps to emphasize the expectation/averaging idea. All geometry is grid-snapped for a blocky aesthetic and scales with canvas size using scale=Math.min(w,h)/240.