Skip to content

Instantly share code, notes, and snippets.

@todbot
Created April 5, 2022 21:33
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save todbot/cf23871c9ef5266b08e863601e59e44a to your computer and use it in GitHub Desktop.
Save todbot/cf23871c9ef5266b08e863601e59e44a to your computer and use it in GitHub Desktop.
Lumon screen saver from Severance, in CircuitPython
# 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)
@todbot
Copy link
Author

todbot commented Apr 5, 2022

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

convert lumon_logo.png -resize 100 -colors 2 -type palette -compress None BMP3:lumon_logo_100x52.bmp

lumon_logo

@todbot
Copy link
Author

todbot commented Apr 6, 2022

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