Created
August 28, 2019 07:50
-
-
Save C-Pro/d0a3654ac1fa03c215cbab1bd4efd3a4 to your computer and use it in GitHub Desktop.
after several typhoons Vladivostok streets are flooded https://www.youtube.com/watch?v=dkgPkHPQqYo
This file contains 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
from curses import wrapper | |
from math import sin | |
from math import radians | |
import time | |
def wave(scr): | |
TEXT='VLADIVOSTOK' | |
scr.clear() | |
my, mx = scr.getmaxyx() | |
step = int((360 * 2) / mx) | |
midy = my/2 | |
midx = mx/2 | |
scr.addstr(int(midy), int(midx-len(TEXT)/2), TEXT) | |
i = 0 | |
while True: | |
for x in range(1, mx): | |
py = int(sin(radians(x+i-step))*(my/4) + midy) | |
y = int(sin(radians(x+i))*(my/4) + midy) | |
scr.addch(py, x, " ") | |
scr.addch(y, x, "*") | |
scr.addstr(int(midy), int(midx-len(TEXT)/2), TEXT) | |
scr.refresh() | |
time.sleep(0.01) | |
i+=step | |
if i>=360: | |
i=0 | |
if __name__ == "__main__": | |
wrapper(wave) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment