Created
July 2, 2015 23:10
-
-
Save rhwlo/c79e935cdbcea0e67506 to your computer and use it in GitHub Desktop.
an animated skull in curses! idea from Achewood
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import curses | |
import time | |
SKULLS = (""" | |
▒▒▒▒▒▒▒ | |
▒▒▓▓▓▓▓▓▓▓▓▓▓▒▒ | |
▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒ | |
▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒ | |
▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒ | |
▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒ | |
▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒ | |
▒▓▓▓▓▓▓░ ░▓▓▓░ ░▓▓▓▓▓▓▒ | |
░▓▓▓▓░ ▒▓▒ ▓▓▓▓░ | |
▓▓▓▒ ▒▓▒ ▒▓▓▓ | |
▓▓▓▒ ▒▓▓▓▒ ▒▓▓▓ | |
░▓▓▓▓▒▒▓▓▓ ▓▓▓▒▒▓▓▓▓░ | |
░▓▓▓▓▓▓▓░ ░▓▓▓▓▓▓▓░ | |
▒▓▓▓▓▓▓▓▒▓▓▓▓▓▓▓▒ | |
▒▓░▓░▓░▓░▓░▓░▓▒ | |
▒▒▒ ▓▓▒▓ ▓ ▓ ▓ ▓▒▓▓ ▒▒▒ | |
▒▓▓▓▓ ▓▓▓▓▓▒▓▒▓▒▓▓▓ ▒▓▓▓▓ | |
▓▓▓▓▓▒▒ ░▓▓▓▓▓▓▓▓▓░ ▒▒▓▓▓▓▓▓ | |
▒▓▓▓▓▓▓▓▓▓▓▓▒▒ ░░░░░ ▒▒▒▒▓▓▓▓▓▓▓▓▓▓ | |
▓▓▓▓░░░▓▓▓▓▓▓▓▓▓▓▒▒▒ ▒▒▓▓▓▓▓▓▓▓▓░░░▓▓▓░ | |
▒▒▒ ░░▓▓▓▓▓▓▓▓▓▓▓▒▒ ░░▓░░░ | |
▒▒▒▒ ░░▓▓▓▓▓▓▓▓▓▓▒▒▒ | |
▒▓▓▓▒▒▒▓▓▓▓▓▓▓▓▓▒▒ ░░▓▓▓▓▓▓▓▓▓▓▓▒▒▒▓▓▓ | |
▓▓▓▓▓▓▓▓▓▓░░░░ ░░▓▓▓▓▓▓▓▓▓▓▓░ | |
░▓▓▓▓▓░ ░░▓▓▓▓░░ | |
▓▓▓░ ▓▓▓▓░ | |
""", """ | |
▒▒▒▒▒▒▒ | |
▒▒▓▓▓▓▓▓▓▓▓▓▓▒▒ | |
▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒ | |
▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒ | |
▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒ | |
▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒ | |
▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒ | |
▒▓▓▓▓▓▓░ ░▓▓▓░ ░▓▓▓▓▓▓▒ | |
░▓▓▓▓░ ▒▓▒ ▓▓▓▓░ | |
▓▓▓▒ ▒▓▒ ▒▓▓▓ | |
▓▓▓▒ ▒▓▓▓▒ ▒▓▓▓ | |
░▓▓▓▓▒▒▓▓▓ ▓▓▓▒▒▓▓▓▓░ | |
░▓▓▓▓▓▓▓░ ░▓▓▓▓▓▓▓░ | |
▒▓▓▓▓▓▓▓▒▓▓▓▓▓▓▓▒ | |
▒▓░▓░▓░▓░▓░▓░▓▒ | |
▒▒▒ ▓▓▒▓ ▓ ▓ ▓ ▓▒▓▓ ▒▒▒ | |
▒▓▓▓▓ ▓▓▓▓▓▒▓▒▓▒▓▓▓ ▒▓▓▓▓ | |
▓▓▓▓▓▒▒ ░▓▓▓▓▓▓▓▓▓░ ▒▒▓▓▓▓▓▓ | |
▒▓▓▓▓▓▓▓▓▓▓▓▒▒ ░░░░░ ▒▒▒▒▓▓▓▓▓▓▓▓▓▓ | |
▓▓▓▓░░░▓▓▓▓▓▓▓▓▓▓▒▒▒ ▒▒▓▓▓▓▓▓▓▓▓░░░▓▓▓░ | |
▒▒▒ ░░▓▓▓▓▓▓▓▓▓▓▓▒▒ ░░▓░░░ | |
▒▒▒▒ ░░▓▓▓▓▓▓▓▓▓▓▒▒▒ | |
▒▓▓▓▒▒▒▓▓▓▓▓▓▓▓▓▒▒ ░░▓▓▓▓▓▓▓▓▓▓▓▒▒▒▓▓▓ | |
▓▓▓▓▓▓▓▓▓▓░░░░ ░░▓▓▓▓▓▓▓▓▓▓▓░ | |
░▓▓▓▓▓░ ░░▓▓▓▓░░ | |
▓▓▓░ ▓▓▓▓░ | |
HA | |
""") | |
def tick(stdscr, onoff): | |
stdscr.clear() | |
selection = SKULLS[1] if onoff else SKULLS[0] | |
for (y, line) in enumerate(selection.split('\n')): | |
stdscr.addstr(curses.LINES // 2 - 15 + y, curses.COLS // 2 - 20, line) | |
stdscr.addch(curses.LINES - 2, curses.COLS - 2, ' ') | |
stdscr.refresh() | |
return not onoff | |
def main(stdscr): | |
onoff = False | |
while True: | |
onoff = tick(stdscr, onoff) | |
time.sleep(1.0) | |
curses.wrapper(main) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment