Skip to content

Instantly share code, notes, and snippets.

@C-Pro
Created August 28, 2019 07:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save C-Pro/d0a3654ac1fa03c215cbab1bd4efd3a4 to your computer and use it in GitHub Desktop.
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
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