Textet ne Sinuskurve oder so. V 0.1
This commit is contained in:
parent
428ae304fe
commit
1379f37646
1 changed files with 46 additions and 0 deletions
46
sintest.py
Executable file
46
sintest.py
Executable file
|
@ -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.")
|
Loading…
Reference in a new issue