コード例 #1
0
ファイル: Brush.py プロジェクト: irskep/splatterboard
 def draw_calligraphy(self, x, y, ds):
     brush_mult = max(1.5-min(ds/20.0,1.2),0)
     brush_mult = (self.last_brush_mult+brush_mult)/2
     self.last_brush_mult = brush_mult
     radius = max(graphics.brush_size,3) * brush_mult
     x_add = radius*self.x_mult
     y_add = radius*self.y_mult
     x1 = x + x_add
     y1 = y + y_add
     x2 = x - x_add
     y2 = y - y_add
     graphics.set_color(*graphics.get_line_color())
     draw.quad((x1,y1,self.lastx1,self.lasty1,self.lastx2,self.lasty2,x2,y2))
     self.lastx1, self.lasty1 = x1, y1
     self.lastx2, self.lasty2 = x2, y2
コード例 #2
0
ファイル: Brush.py プロジェクト: irskep/splatterboard
 def draw_variable(self, x, y, ds):
     brush_mult = max(1.5-min(ds/20.0,1.2),0)
     brush_mult = (self.last_brush_mult+brush_mult)/2.0
     radius = max(graphics.brush_size,3)
     angle = math.atan2(y-self.lasty,x-self.lastx)+math.pi/2.0
     x_add1 = radius*math.cos(angle)*brush_mult*0.96
     y_add1 = radius*math.sin(angle)*brush_mult*0.96
     x_add2 = radius*math.cos(angle)*self.last_brush_mult*0.96
     y_add2 = radius*math.sin(angle)*self.last_brush_mult*0.96
     graphics.set_color(*graphics.get_line_color())
     self.draw_point(x,y,brush_mult*2.0)
     graphics.set_line_width(1.0)
     draw.quad((x+x_add1,           y+y_add1,
                         self.lastx+x_add2,  self.lasty+y_add2,
                         self.lastx-x_add2,  self.lasty-y_add2,
                         x-x_add1,           y-y_add1))
     self.last_brush_mult = brush_mult