kopia lustrzana https://github.com/villares/sketch-a-day
comments day 25
rodzic
f7704738cd
commit
1f4ad8b1d1
|
|
@ -2,8 +2,8 @@
|
|||
s18025c - Alexandre B A Villares
|
||||
https://abav.lugaralgum.com/sketch-a-day
|
||||
|
||||
Move the cursor over the image to draw
|
||||
the 'brush' responds to the speed of the mouse.
|
||||
Drag the mouse over the canvas to draw
|
||||
'brush' strokeWeight() varies with mouse speed.
|
||||
"""
|
||||
|
||||
pspeed = 0
|
||||
|
|
@ -15,12 +15,12 @@ def setup():
|
|||
def draw():
|
||||
global pspeed
|
||||
x, y, px, py = mouseX, mouseY, pmouseX, pmouseY
|
||||
speed = (dist(x, y, px, py))**0.5
|
||||
w = ((10 - speed) + (10 - pspeed))/2
|
||||
speed = (dist(x, y, px, py))**0.5 # squareroot of dist to previous mouse pos
|
||||
w = ((10 - speed) + (10 - pspeed))/2 # mean of 10 minus speed & previous
|
||||
strokeWeight(abs(w))
|
||||
if mousePressed:
|
||||
line(x, y, px, py)
|
||||
pspeed = speed
|
||||
pspeed = speed # updates previous speed
|
||||
|
||||
def keyPressed():
|
||||
background(200)
|
||||
Ładowanie…
Reference in New Issue