kopia lustrzana https://github.com/villares/sketch-a-day
27 wiersze
396 B
Python
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()
|
|
|