Animating 2D cellular automata with the entire grid in sight

m = 20;

Animate[ArrayPlot[ArrayPad[CellularAutomaton[20, {{1}, 0}, {n, All}], 
    {{0, m - n}, {m - n, m - n}}], Mesh -> True], 
 {n, 0, m, 1}, AnimationRunning -> False]

enter image description here


You can use PadRight and PadLeft to pad the matrix with zeroes.

One possible solution is

Module[{rule = 20, max = 20, ca},
 ca = CellularAutomaton[rule, {{1}, 0}, {max, All}];
 Animate[
  ArrayPlot[
   (* Display only the first n rows of ca and pad the rest with zeroes *)
   PadRight[ca[[;; n]], {max + 1, 2 max + 1}],
   Mesh -> True
   ], {n, 1, max, 0}, AnimationRunning -> False]
 ]