Exemple #1
0
 def keep_drawing(self, x, y, dx, dy):
     self.rx, self.ry = x, y
     radius = math.sqrt(
         (self.rx - self.x)*(self.rx - self.x)+(self.ry - self.y)*(self.ry - self.y)
     )
     theta = math.atan2(self.ry-self.y, self.rx-self.x)
     graphics.set_color(1,1,1,1)
     draw.image(self.canvas_pre,graphics.canvas_x,graphics.canvas_y)
     if graphics.fill_shapes:
             #graphics.set_color(color=self.fill_color)
             draw.ngon(self.x,self.y,radius,self.sides,theta, self.fill_colors)
     if graphics.outline_shapes:
         graphics.set_line_width(graphics.user_line_size)
         graphics.set_color(color=self.line_color)
         draw.ngon_outline(self.x, self.y, radius, self.sides, theta)
Exemple #2
0
 def stop_drawing(self, x, y):
     if self.railroad or self.dna: return
     if self.spiral or self.weave:
         x1 = x + self.spiral_radius*math.cos(self.spiral_angle)
         y1 = y + self.spiral_radius*math.sin(self.spiral_angle)
         x2 = x - self.spiral_radius*math.cos(self.spiral_angle)
         y2 = y - self.spiral_radius*math.sin(self.spiral_angle)
         graphics.set_color(color=self.last_color_1)
         self.draw_point(x1,y1)
         graphics.set_color(color=self.last_color_2)
         self.draw_point(x2,y2)
     else:
         graphics.set_color(color=self.last_color_1)
         self.draw_point(x,y)
         if self.arrow_end:
             draw.ngon(x, y, max(graphics.brush_size*3, 5), 3, self.arrow_angle)