nowox
nowox

Reputation: 29116

Ascii art animation file format?

I noticed several format such as *.vt or *.ans that can be rendered in terminal. By looking at these file I noticed the useful ANSI escape code \e[H.

Unfortunately I did not find any specifications for these files. Is there any format do use ?

My goal is to write a program that displays a shape in ASCII which is animated over time.

My current solution relies on printf("\e[H") and use usleep(10000), but I would like to use a better approach that could use:

./gen_animation > a.vt | player --fps=100

Upvotes: 1

Views: 446

Answers (1)

user12515980
user12515980

Reputation:

I am not aware of popular ASCII art animation file format, but recently I created my own of Animated ASCII in which each frame is delimited using a special symbol.

With a "frame delimiter", I can easily split each frame in higher-language like C#:

            string txt=File.ReadAllText("C:\\airplane.mp4.txt");
            string[] frame = txt.Split('$');
            for (int f = 0; f < frame.Length; f++)
            {
                Console.SetCursorPosition(0, 0);
                Console.Write(frame[f]);
                System.Threading.Thread.Sleep(50);
            }

While this might not answer your question, I find it difficult to choose between posting this as comment or as "answer", because "comments are used to ask for clarification or to point out problems in the post", I just wanted to give some hints.

Upvotes: 2

Related Questions