Toggle Navigation
Hatchery
Eggs
Matrix multiplication demonstration!
robotman2412_pygfx.py
Users
Badges
Login
Register
MCH2022 badge?
go to mch2022.badge.team
robotman2412_pygfx.py
raw
Content
import display, math from .robotman2412_matrix import * stack = MatrixStack2D() stack.translate(display.width() / 2, display.height() / 2) bigFont = "PermanentMarker22" smallFont = "7x5" foregroundColor = 0x000000 backgroundColor = 0xffffff textColor = 0x000000 display.drawFill(foregroundColor) display.flush() display.drawFill(backgroundColor) display.flush() stack.scale2D(40, 30) while True: stack.rotate2D(math.pi / 16) stack.push() display.drawFill(backgroundColor) x0, y0 = stack.transformPoint(-1, -1) x1, y1 = stack.transformPoint(1, -1) x2, y2 = stack.transformPoint(1, 1) x3, y3 = stack.transformPoint(-1, 1) display.drawLine(round(x0), round(y0), round(x1), round(y1), 0x000000) display.drawLine(round(x1), round(y1), round(x2), round(y2), 0x000000) display.drawLine(round(x2), round(y2), round(x3), round(y3), 0x000000) display.drawLine(round(x3), round(y3), round(x0), round(y0), 0x000000) stack.pop() display.flush()