sketch-a-day/2019/sketch_191223a/cube.py

27 wiersze
396 B
Python

class Cube :
ax = 0
ay = 0
def __init__(self, id, size_, x, y, c) :
self.id = id
self.size = size_
self.x = x
self.y = y
self.c = c
def rotate(self, x, y) :
self.ax += x
self.ay += y
def draw(self) :
fill(self.c)
pushMatrix()
translate(self.x, self.y)
rotateX(self.ay)
rotateY(-self.ax)
box(self.size)
popMatrix()