Beispiel #1
0
 def keep_drawing(self, x, y, dx, dy):
     self.x2, self.y2 = x, y
     graphics.set_color(1,1,1,1)
     draw.image(self.canvas_pre,graphics.canvas_x,graphics.canvas_y)
     graphics.set_line_width(graphics.user_line_size)
     graphics.set_color(color=self.line_color)
     draw.line(self.x1, self.y1, self.x2, self.y2)
Beispiel #2
0
 def draw_spiral_weave(self, x, y, angle, ds):
     if self.spiral:
         self.spiral_angle += 4.7 * ds * self.freq_scale
     if self.weave:
         self.spiral_angle = angle+math.pi/2
         self.spiral_radius = max(graphics.brush_size,5)*math.sin(self.iteration*self.freq_scale)
     x_add = self.spiral_radius*math.cos(self.spiral_angle)
     y_add = self.spiral_radius*math.sin(self.spiral_angle)
     x1 = x + x_add
     y1 = y + y_add
     x2 = x - x_add
     y2 = y - y_add
     self.last_color_1 = graphics.get_line_color()
     self.last_color_2 = graphics.get_fill_color()
     graphics.set_color(color=self.last_color_1)
     self.draw_point(x1,y1)
     graphics.set_line_width(graphics.brush_size)
     draw.line(x1, y1, self.lastx1, self.lasty1)
     
     graphics.set_color(color=self.last_color_2)
     self.draw_point(x2,y2)
     graphics.set_line_width(graphics.brush_size)
     draw.line(x2, y2, self.lastx2, self.lasty2)
     self.lastx1, self.lasty1 = x1, y1
     self.lastx2, self.lasty2 = x2, y2
Beispiel #3
0
 def keep_drawing(self, x, y, dx, dy):
     graphics.set_color(1,1,1,1)
     self.draw_point(self.lastx,self.lasty)
     self.draw_point(x,y)
     graphics.set_line_width(graphics.brush_size)
     draw.line(x, y, self.lastx, self.lasty)
     graphics.set_color(0.5,0.5,0.5,1)
     graphics.set_line_width(0.8)
     radius = graphics.brush_size*0.8/2
     draw.ellipse_outline(x-radius,y-radius,x+radius,y+radius)
     self.lastx, self.lasty = x, y
Beispiel #4
0
 def keep_drawing(self, x, y, dx, dy):
     ds = math.sqrt(dx*dx+dy*dy)
     self.iteration += ds
     if self.calligraphy:
         self.draw_calligraphy(x,y,ds)
     elif self.variable:
         self.draw_variable(x,y,ds)
     else:
         self.last_color_1 = graphics.get_line_color()
         graphics.set_color(color=self.last_color_1)
         self.draw_point(x,y)
         graphics.set_line_width(graphics.brush_size)
         draw.line(x, y, self.lastx, self.lasty)
     self.lastx, self.lasty = x, y
Beispiel #5
0
 def draw_other(self, x, y, angle, ds):
     graphics.set_color(color=self.last_color_1)
     self.state_flip += ds
     if self.state_flip > graphics.brush_size*2:
         self.state_flip = 0
         self.dot_on = not self.dot_on
         if not self.dot_on:
             self.last_color_1 = graphics.get_line_color()
     if self.dot_on or not self.dotted:
         if self.state_flip == 0:
             self.draw_point(self.lastx1, self.lasty1)
         self.draw_point(x,y)
         graphics.set_line_width(graphics.brush_size)
         draw.line(x, y, self.lastx1, self.lasty1)
     if self.arrow_end:
         self.arrow_angle = self.arrow_angle*0.5 + angle*0.5
     self.lastx1, self.lasty1 = x, y
Beispiel #6
0
 def draw_railroad_dna(self, x, y, angle, ds):
     self.spiral_angle = angle+math.pi/2
     if self.railroad:
         self.spiral_radius = max(graphics.brush_size*2,10)
     else:
         self.spiral_radius = max(graphics.brush_size*2,10)
         self.spiral_radius *= math.sin(self.iteration*self.freq_scale)
     x_add = self.spiral_radius*math.cos(self.spiral_angle)
     y_add = self.spiral_radius*math.sin(self.spiral_angle)
     x1 = x + x_add
     y1 = y + y_add
     x2 = x - x_add
     y2 = y - y_add
     self.last_color_1 = graphics.get_line_color()
     self.last_color_2 = graphics.get_line_color()
     graphics.set_color(color=self.last_color_1)
     self.draw_point(x1,y1,0.6)
     graphics.set_line_width(graphics.brush_size*0.6)
     draw.line(x1, y1, self.lastx1, self.lasty1)
     graphics.set_color(color=self.last_color_2)
     self.draw_point(x2,y2,0.6)
     graphics.set_line_width(graphics.brush_size*0.6)
     draw.line(x2, y2, self.lastx2, self.lasty2)
     self.state_flip += ds
     if self.railroad:
         x_add *= 1.3
         y_add *= 1.3
     if self.state_flip > graphics.brush_size * 2:
         rx1 = x + x_add
         ry1 = y + y_add
         rx2 = x - x_add
         ry2 = y - y_add
         self.state_flip = 0
         if self.railroad:
             draw.line(rx1,ry1,rx2,ry2)
         else:
             graphics.set_color(color=random.choice(graphics.rainbow_colors))
             draw.line(x,y,rx1,ry1)
             graphics.set_color(color=random.choice(graphics.rainbow_colors))
             draw.line(x,y,rx2,ry2)
     self.lastx1, self.lasty1 = x1, y1
     self.lastx2, self.lasty2 = x2, y2
Beispiel #7
0
 def keep_drawing(self, x, y, dx, dy):
     graphics.set_color(color=graphics.get_line_color())
     if self.scribble: x, y = self.scramble_coords(x, y)
     draw.line(self.x, self.y, x, y)
     self.x, self.y = x, y