diff --git a/sintest.py b/sintest.py new file mode 100755 index 0000000..f796c54 --- /dev/null +++ b/sintest.py @@ -0,0 +1,46 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- + + +import os, sys, termios, tty, time, random +from math import sin, cos, sqrt +from time import sleep + + +termsize_xy = os.get_terminal_size() +xmax = termsize_xy[0] - 1 +ymax = termsize_xy[1] + +tree = "🌳" +frequency = int(xmax / 5) +street = tree +for i in range(0, frequency): + street += " " +street += tree +streetwidth = len(street) +amplitude = (xmax - streetwidth*4) / 3 +streetpos = amplitude +pi = 3.1416 +deg2rad = pi / 180 +toggle = 1 +maxpos = xmax - streetwidth +maxamp = xmax - streetwidth / 3 + + +def curpos(x, y): + print("\033[%d;%dH" % (y, x), end="", flush=True) + + +while True: + sleep(0.01) + amplitude += toggle + frequency = frequency + toggle + streetpos = int(sin(frequency * deg2rad) * cos(frequency * deg2rad + 1) * amplitude + streetwidth*4) + frequency += toggle + curpos(streetpos, ymax) + print(street) + if amplitude >= maxamp or amplitude < 3: + toggle *= -1 + + +sys.exit("Schulz nun.")