Alexandre B A Villares 2018-01-28 18:10:44 -02:00
rodzic 0c9c66022e
commit f90f9be538
4 zmienionych plików z 41 dodań i 0 usunięć

Wyświetl plik

@ -8,6 +8,13 @@ If you enjoy this, make a small donation [here](https://www.paypal.com/cgi-bin/w
----
![28c](sketch_180128c/sketch_180128c.png)
028: [sketch_180128c](https://github.com/villares/sketch-a-day/tree/master/sketch_180128c) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
Like 27 but on grayscale
----
![27c](sketch_180127c/sketch_180127c.png)
027: [sketch_180127c](https://github.com/villares/sketch-a-day/tree/master/sketch_180127c) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)][YouTube](https://www.youtube.com/watch?v=A-rqkru79Dw)

Wyświetl plik

@ -0,0 +1,2 @@
mode=Python
mode.id=jycessing.mode.PythonMode

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 210 KiB

Wyświetl plik

@ -0,0 +1,32 @@
"""
s18028c - Alexandre B A Villares
https://abav.lugaralgum.com/sketch-a-day
Drag the mouse over the canvas to draw
the 'brush' varies with mouse speed.
"""
speed = [0, 0]
LIST = []
def setup():
size(500, 500)
colorMode(HSB)
def draw():
background(100)
for i, (w, x, y, px, py) in enumerate(LIST):
c = map(w, 0, 10, 0, 255) # maps 1 to 10 to 0 to 255 scale
stroke(abs(255 - (c + frameCount) % 511)) # circle colors
strokeWeight(abs(w))
line(x, y, px, py)
x, y, px, py = mouseX, mouseY, pmouseX, pmouseY
speed[0] = (dist(x, y, px, py))**0.5 # squareroot of dist to previous mouse pos
w = ((10 - speed[0]) + (10 - speed[1]))/2 # mean of 10 minus speed & previous
if mousePressed:
LIST.append((w, x, y, px, py))
speed[1] = speed[0] # updates previous speed
def keyPressed():
LIST[:] = []