Answer the question
In order to leave comments, you need to log in
Linux, how to write your own "train"?
Guys, I saw a gif for a long time where the train in the Linux terminal goes. And I became interested in how to write my own, but for example, not a steam locomotive, but a typewriter?
And it would be cool if other users could install it. Do not tell me where to dig and in what direction? Just out of curiosity, I would like to try it.
Answer the question
In order to leave comments, you need to log in
The easiest way.
1) We count the number of characters in the terminal in height and width.
2) We estimate how many frames the animation will be.
3) We draw (write in a notepad) animation with symbols\letters\numbers with the maximum width and height obtained in step 1 and in the number of frames obtained in step 2.
4) For example, 2 frames will turn out.
5) We write a simple script that uses the minimum number of the simplest console commands in the following form:
for (цикл равный числу кадров)
clear (отчистить экран)
for (цикл равный числу строк в кадре)
echo (строка кадра)
sleep (время в секундах которое надо подождать до следующего кадра)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question