It may be common sense, but I will write a simple way to animate with a string. You can make an animation like this.
I made it with Python 3.6.1, but in principle it can be made even if the language is different. If the environment is such that the carriage return is recognized, it will be displayed as desired.
The mechanism is simple.
There are only two. After that, if you adjust the display interval like an animation, it will look like that.
Is the simplest one like this?
python
import time
interval = 0.50
print("1 \r", end="")
time.sleep(interval)
print(" 2 \r", end="")
time.sleep(interval)
print(" 3 \r", end="")
time.sleep(interval)
print(" 4 \r", end="")
time.sleep(interval)
print(" 5 \r", end="")
time.sleep(interval)
print(" \r", end="")
time.sleep(interval)
If you make it a little more programmatic, it will look like the following.
python
import time
def animation(sts, times=3, interval=0.25):
for n in range(times):
for st in sts:
print(st, end="")
time.sleep(interval)
print("\r", end="")
print()
sts = [
"(・ ∀ ・)",
"(・ ∀ ・) Nino",
"(・ ∀ ・) Nino Nino",
"(・ ∀ ・)",
"(・ ∀ ・) Hi",
"(・ ∀ ・) Pugera",
]
times = 3
interval = 0.25
animation(sts, times, interval)