comments day 25

main
Alexandre B A Villares 2018-01-26 00:12:03 -02:00
rodzic f7704738cd
commit 1f4ad8b1d1
1 zmienionych plików z 5 dodań i 5 usunięć

Wyświetl plik

@ -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)