-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlirik-lagu.py
More file actions
32 lines (26 loc) · 845 Bytes
/
Copy pathlirik-lagu.py
File metadata and controls
32 lines (26 loc) · 845 Bytes
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
import time
import sys
lyrics = [
("\nSungguh dirimu membuatku", 0.09),
("terlalu bersemangat 😍", 0.10),
("Jalani hari-hariku dengan hebat", 0.10),
("Kau tau hidup tanpamu itu berat 😣", 0.11),
("Denganmu aku kuat 🤗", 0.09),
]
delays = [1.5, 1.1, 1.1, 1.1, 1.1]
def animate_text(text, char_delay):
for char in text:
sys.stdout.write(char)
sys.stdout.flush()
time.sleep(char_delay)
sys.stdout.write('\n')
sys.stdout.flush()
def main():
for i, (text, char_delay) in enumerate(lyrics):
animate_text(text, char_delay)
if i < len(lyrics) - 1:
# Calculate the time until the next line should start
next_line_delay = max(0, delays[i] - len(text) * char_delay)
time.sleep(next_line_delay)
if __name__ == "__main__":
main()