Created
April 5, 2022 21:33
-
-
Save todbot/cf23871c9ef5266b08e863601e59e44a to your computer and use it in GitHub Desktop.
Lumon screen saver from Severance, in CircuitPython
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
# Lumon screen saver from Severance | |
# 5 Apr 2022 - @todbot / Tod Kurt, from @jedgarpark suggestion | |
import time | |
import board | |
import displayio | |
logo_fname = "/lumon_logo_100x52.bmp" | |
logo_w = 100 | |
logo_h = 52 | |
display = board.DISPLAY | |
maingroup = displayio.Group() | |
display.show(maingroup) # put main group on display, everything goes in maingroup | |
# start in the middle of the display | |
x = display.width // 2 | |
y = display.height // 2 | |
# our starting velocity | |
xvel = 1.5 | |
yvel = 1.25 | |
# load logo bitmap, make its background transparent, put on the stage | |
bitmap = displayio.OnDiskBitmap(logo_fname) | |
palette = bitmap.pixel_shader | |
palette.make_transparent(0) | |
logo = displayio.TileGrid(bitmap, pixel_shader=palette) | |
maingroup.append(logo) # add our logo to the main display group | |
while True: | |
# move logo to new x,y | |
logo.x = int(x) | |
logo.y = int(y) | |
# update x,y based on velocity | |
x = x + xvel | |
y = y + yvel | |
# if we hit an edge, bounce! | |
if x > display.width-logo_w or x < 0: | |
xvel = -xvel | |
if y > display.height-logo_h or y < 0: | |
yvel = -yvel | |
display.refresh( target_frames_per_second=60 ) | |
time.sleep(0.001) |
And if you add this line before display.refresh()
:
logo.pixel_shader[1] = rainbowio.colorwheel( time.monotonic()*100 )
and import rainbowio
at the top, you get Rainbow Lumon!
severrainbowance.mp4
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The results:
lumon_screensaver_nohdr.mp4
Using this PNG logo file, (from the very excellent https://lumonscreensaver.rexaril.repl.co, found on /r/SeveranceAppleTVPlus), and converted to BMP with