-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanimation.py
50 lines (30 loc) · 957 Bytes
/
animation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from time import gmtime, sleep
# PARAMETERS
frame_input = 'ETH' # the string to use as input
frame_repeats_per_line = 7 # number of times the frame is printed per line
lines_printed_per_second = 5 # number of lines printed per second
# /PARAMETERS
################################################################
# CODE
length_of_frame_input = len(frame_input)
last_char = frame_input[-1]
frame_input = frame_input[:-1]
def per_second_output():
seconds = gmtime().tm_sec
frame_index = seconds % length_of_frame_input
last_char_position = length_of_frame_input - frame_index - 1
line = ''.join((
frame_input[:last_char_position],
last_char,
frame_input[last_char_position:]
)) * frame_repeats_per_line
print(
'\n'.join(
(line,) * lines_printed_per_second
)
)
if __name__ == '__main__':
while True:
per_second_output()
sleep(1)
# /CODE