Created
January 27, 2024 04:39
-
-
Save lvm/64346a0b05d259d80552d7ce2c2ceb47 to your computer and use it in GitHub Desktop.
plain text plasma p/raspi w/3.5 screen
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
import math | |
import time | |
s = math.sin | |
q = math.sqrt | |
i = lambda a, b, c: a in range(b, c) | |
def c(x, y): | |
# http://www.purplemath.com/modules/distform.htm | |
t = time.time() * 1000 / 74 | |
v = s(q((x + t - 99) ** 2 + (y - 66) ** 2) / 7) + s(q((x - 99) ** 2 + (y - 66) ** 2) / 7) + s(q((x - 99) ** 2 + (t / 4) ** 2) / 7) + s(q((x - 99) ** 2 + (y + t - 66) ** 2) / 7) | |
return int((7 + v) * 20) | |
def C(v): | |
return " " if i(v, 50, 59) else "'" if i(v, 60, 70) else "." if i(v, 70, 74) else ":" if i(v, 75, 99) else "!" if i(v, 100, 124) else "s" if i(v, 125, 174) else "5" if i(v, 175, 199) else "%" if i(v, 200, 224) else "#" if i(v, 225, 255) else "$" | |
def P(): | |
print("\n".join("".join([C(c(y, x)) for x in range(74, 0, -1)]) for y in range(42, 0, -1)), flush=1) | |
time.sleep(0.041) | |
if __name__ == "__main__": | |
while 1: | |
P() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment