Skip to content

Instantly share code, notes, and snippets.

@rsbohn
Created September 3, 2022 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rsbohn/6b465bd6b97dd32511106cbcbe9c54b3 to your computer and use it in GitHub Desktop.
Save rsbohn/6b465bd6b97dd32511106cbcbe9c54b3 to your computer and use it in GitHub Desktop.
# SPDX-FileCopyrightText: Copyright (c) 2022 Randall Bohn (dexter)
#
# SPDX-License-Identifier: MIT
import math
import time
from vectorio import Circle
import displayio
import board
display = board.DISPLAY
def spread(duration):
"for _duration_ seconds return a value between 0. and 1."
end_time = time.monotonic() + duration
while time.monotonic() < end_time:
t = end_time - time.monotonic()
yield 1-t/duration
palette = displayio.Palette(8)
palette[0]=0xFF9933
cc = Circle(radius=48, x=32, y=display.width//2,
pixel_shader=palette)
splash = displayio.Group()
splash.append(cc)
display.show(splash)
while True:
for x in spread(8):
cc.x = 32+int((display.width-64)*x)
cc.y = display.height//2 + int(64*math.sin(4*math.pi*x))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment