Creating a Table of Items for GIF creation

I want to create a table as shown below so that the steps from the first item to the second item, and the second item to the third item, etc. can be animated.

I am not at liberty to post tested code right now, but I think this would work:

Table[Grid[Partition[Riffle @@ {Range[n],Range[n]^2},2]], {n,1,3}]


Does anyone have a cooler way of doing this? And by cooler, I mean a way that doesn't require the use of Riffle and Partition (by creating something that is properly formatted for Grid to begin with).

Also, if the above code doesn't work, can someone please tell me why?

• Where is the problem with posting the "tested code"? Do you have a copy of Mathematica (BTW your example works, but all entries are centered vertically)? Aug 15 '13 at 15:55
• @YvesKlett: I thought of the solution while at work (where I don't have Mathematica). Thanks for checking the accuracy of my example - I'm not concerned about the centering since this is easily remedied! Aug 15 '13 at 16:24

If I am understanding your intention:

n = 6;

start = Array[{#, #^2} &, n];

hidden = Map[Invisible, start, {2}];

frames = Table[Grid @ PadRight[Take[start, x], n, hidden], {x, n}];

Export["tabletext.gif", frames, "DisplayDurations" -> 0.3]


Manipulate[
Module[{i, j, r},
r = Table[Flatten@Table[If[j < i, {0, 0}, {i, i^2}], {j, n}], {i, n}] /.0 -> "";
Grid[r, Frame -> All, FrameStyle -> LightGray, Spacings -> {.5, .5}]
],
{{n, 6, "how big?"}, 3, 20, 1, Appearance -> "Labeled"}
]


To export the manipulate to animated GIF, you can use Vitaliy Kaurov ManToGif program http://community.wolfram.com/groups/-/m/t/86994?p_p_auth=4rPWkLpF