-
Notifications
You must be signed in to change notification settings - Fork 39
/
pusheen.py
executable file
·94 lines (74 loc) · 3.09 KB
/
pusheen.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" Pusheen
Script that mimics `sl` but with pusheen instead of a train.
"""
from time import sleep
from math import floor
import curses
FRAME_TIME = 0.04
# KEY FRAMES
PUSHEEN = """ ▐▀▄ ▄▀▌ ▄▄▄▄▄▄▄
▌ ▀▄▄▄▄▄▀ ▐▄▀▀ ██ ██ ▀▀▄
▐ ▀ ▀ ▀ ▀▄
▌ ▄ ▀▄
▀█ █ █ █ ▀ ▌
▀▌ ▀ ▀ ▀▀ ▐ ▄▄
▐ ▌▄█ █
▐ █ █▀
▐ █▀
▐ ▌
▌ ▐
▐ ▌
▌ ▐
▐▄ ▄▌
""".splitlines()
PUSHEEN_FEET = """ ▀▀▀▀▀▀▀▀▄▄▀▀▀▀▀▀▀▀▀▀▀▀▀▄▄▀
▀▀▀▀▀▀▀▀▄▄▀▀▀▀▀▀▀▀▀▀▀▀▀▄▄▀
▀▀▀▀▀▀▀▀▄▄▀▀▀▀▀▀▀▀▀▀▀▀▀▄▄▀
▀▀▀▀▀▀▀▀▄▄▀▀▀▀▀▀▀▀▀▀▀▀▀▄▄▀
▀▄▄▀▀▀▀▀▄▄▀▀▀▀▀▀▀▄▄▀▀▀▀▀▄▄▀
▀▄▄▀▀▀▀▀▄▄▀▀▀▀▀▀▀▄▄▀▀▀▀▀▄▄▀
▀▄▄▀▀▀▀▀▄▄▀▀▀▀▀▀▀▄▄▀▀▀▀▀▄▄▀
▀▄▄▀▀▀▀▀▄▄▀▀▀▀▀▀▀▄▄▀▀▀▀▀▄▄▀
▀▄▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄▄▀▀▀▀▀▀▀▀
▀▄▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄▄▀▀▀▀▀▀▀▀
▀▄▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄▄▀▀▀▀▀▀▀▀
▀▄▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄▄▀▀▀▀▀▀▀▀
""".splitlines()
def main(win):
#invisible cursor
curses.curs_set(0)
# get size of terminal
MAX_Y, MAX_X = win.getmaxyx()
CENTER = floor(MAX_Y / 2) - floor((len(PUSHEEN) + 1) / 2) - 1
feet_frame = 0
# fade in from right
for x in range(MAX_X):
win.erase()
# draw body
for y, line in enumerate(PUSHEEN):
win.addstr(CENTER + y, MAX_X-(x+1), line[:x])
# draw feet
if feet_frame == len(PUSHEEN_FEET):
feet_frame = 0
win.addstr(CENTER + len(PUSHEEN), MAX_X-(x+1), PUSHEEN_FEET[feet_frame][:x])
feet_frame += 1
win.refresh()
sleep(FRAME_TIME)
# fade out left
# range is based on the length of the longest string
for x in range(len(max(PUSHEEN, key=len))):
win.erase()
# draw body
for y, line in enumerate(PUSHEEN):
win.addstr(CENTER + y, 0, line[x:])
# draw feet
if feet_frame == len(PUSHEEN_FEET):
feet_frame = 0
win.addstr(CENTER + len(PUSHEEN), 0, PUSHEEN_FEET[feet_frame][x:])
feet_frame += 1
win.refresh()
sleep(FRAME_TIME)
if __name__ == '__main__':
curses.wrapper(main)