I'm trying to come up with a way to create a growing animation in the console (using characters to make a 2D shape). Here's an example:
Frames 1 2 3 4
XX XX
XX XX X X X X
X X X X X X X X
X X X X X
X X X X X
X X X
X
The animation is given the final shape (in the example, this is the 4th frame). The shape must be symmetrical along the y-axis and have a district center point (in other words, the height and width must both be an odd number of characters). I want the animation to figure out all the frames between the first and last frames. Every frame should expand in all directions 1 character (so it's up to the animation program to calculate the number of frames needed). Expanding 1 character in all directions also implies the height and width of the final shape are equal.
I want to be able to give the animation any 2D shape that meets the constraints defined above and have an animation generated from it. One idea I had is to reverse the animation and "shrink" the shape, then play that reversed animation backward somehow (perhaps by storing each frame on a FIFO stack of strings). I just don't have any idea how to do that or even where to start. Here's another example:
Frames 1 2 3 4
Y
Y Y Y
Y Y Y Y Y
Y Y Y Y Y Y Y
Y Y Y Y Y
Y Y Y
Y
For specific implementation examples, I'm wanting this done in C++ using the Windows console API.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…