Created
September 3, 2022 16:04
-
-
Save rsbohn/6b465bd6b97dd32511106cbcbe9c54b3 to your computer and use it in GitHub Desktop.
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
# 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