Created
April 29, 2022 04:57
-
-
Save rothgar/96a351adda1d20eeaabf6cd5dd67989b to your computer and use it in GitHub Desktop.
CirCuitPython green square fall
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
import board | |
from time import sleep | |
import displayio | |
from adafruit_display_shapes.rect import Rect | |
from adafruit_matrixportal.matrix import Matrix | |
# --- Display setup --- | |
matrix = Matrix(bit_depth=6, width=32, height=32) | |
display = matrix.display | |
# Make the display context | |
splash = displayio.Group() | |
display.show(splash) | |
# Make a background color fill | |
color_bitmap = displayio.Bitmap(31, 32, 1) | |
color_palette = displayio.Palette(1) | |
color_palette[0] = 0x000000 | |
bg_sprite = displayio.TileGrid(color_bitmap, x=0, y=0, | |
pixel_shader=color_palette) | |
splash.append(bg_sprite) | |
########################################################### | |
rect = Rect(10, 0, 4, 4, outline=0x00FF00) | |
splash.append(rect) | |
while rect.y < (32 - rect.height): | |
sleep(.2) | |
rect.y = rect.y + 1 | |
rect.fill = fill=0x00FF00 | |
while True: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment