def draw(canvas): """ {{{ - dessine en boucle - Args : canvas (string) - Returns : none """ stroke(White) # 75% transparent black. strokewidth(1) # random position, rect rotation, color and tranparency x1 = random()*canvas.width y1 = random()*canvas.height # # | Y # | # | # | X # 0 ------------ # rot = int(random()*4)*90 rndColor = color(random(),random(),random(),random()) # You pass Color objects to fill() and stroke(). # A Color object can be created with the color command. # It has clr.r, clr.g, clr.b, clr.a properties : # clr = color(0.25, 0.15, 0.75, 0.5) # 50% transparent purple/blue. # fill(clr) translate(x1,y1) rotate(rot) fill(rndColor) rect(0,0,rectWidth,rectHeight)
def draw(canvas): """ {{{ - dessine en boucle - Args : canvas (string) - Returns : none """ stroke(White) # 75% transparent black. strokewidth(1) # random position, rect rotation, color and tranparency x1 = random() * canvas.width y1 = random() * canvas.height # # | Y # | # | # | X # 0 ------------ # rot = int(random() * 4) * 90 rndColor = color(random(), random(), random(), random()) # You pass Color objects to fill() and stroke(). # A Color object can be created with the color command. # It has clr.r, clr.g, clr.b, clr.a properties : # clr = color(0.25, 0.15, 0.75, 0.5) # 50% transparent purple/blue. # fill(clr) translate(x1, y1) rotate(rot) fill(rndColor) rect(0, 0, rectWidth, rectHeight)
def draw(canvas): keys = canvas.keys if 'f5' in keys: self.rects = self.generateRectangles() canvas.clear() nbg.rect(0, 0, canvas.width, canvas.height) for rect in self.rects: rect.draw()
def draw(canvas): canvas.clear() # dessin des rectangles du fond for item in rect_list: clr=color(float(item[4]),float(item[5]),float(item[6]),float(item[7])) stroke(clr) fill(clr) rect(int(item[0]),int(item[1]),int(item[2]),int(item[3]))
def draw(canvas): canvas.clear() # dessin des rectangles du fond for item in rect_list: clr = color(float(item[4]), float(item[5]), float(item[6]), float(item[7])) stroke(clr) fill(clr) rect(int(item[0]), int(item[1]), int(item[2]), int(item[3]))
def func(): rect(x=-100, y=-100, width=300, height=max(100, canvas.mouse.y))
def draw(self): rect(0, 0, self.width, self.height, fill=self.clr, stroke=self.clr)
def draw(self): rect = nbg.rect(self.x, self.y, self.width, self.height, fill=self.fill)