Octopus_Carnival/ono_sendai/animation/octopus.py

42 lines
852 B
Python
Raw Normal View History

2019-08-18 17:19:11 +02:00
from colorama import Style, Fore
from time import sleep
from os import system
2019-08-25 18:51:45 +02:00
import sys
2019-08-18 17:19:11 +02:00
frames = []
for i in range(5):
2019-08-19 00:12:42 +02:00
with open('animation/'+str(i)+'.txt', 'r') as f:
2019-08-18 17:19:11 +02:00
content = f.read()
frames.append(f'{Fore.MAGENTA}'+content+f'{Style.RESET_ALL}')
def animate(n):
2019-08-19 00:12:42 +02:00
system('clear')
2019-08-18 17:19:11 +02:00
for i in range(n):
print(frames[i%5])
sleep(0.2)
system('clear')
2019-08-25 19:10:28 +02:00
with open('animation/intro2.txt', 'r') as f:
intro_text = f.read()
2019-08-25 18:51:45 +02:00
def intro():
system('clear')
print(f'{Fore.MAGENTA}', end='')
2019-08-25 19:10:28 +02:00
for ch in intro_text:
2019-08-25 18:51:45 +02:00
print(ch, end='')
sys.stdout.flush()
sleep(0.01)
# for i in range(5):
# system('clear')
# print(anim)
# sleep(0.4)
print(f'{Style.RESET_ALL}')
2019-08-18 17:19:11 +02:00
if __name__ == '__main__':
from sys import argv
animate(int(argv[1]))