kopia lustrzana https://github.com/villares/sketch-a-day
day 28
rodzic
0c9c66022e
commit
f90f9be538
|
|
@ -8,6 +8,13 @@ If you enjoy this, make a small donation [here](https://www.paypal.com/cgi-bin/w
|
|||
|
||||
----
|
||||
|
||||

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

|
||||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
mode=Python
|
||||
mode.id=jycessing.mode.PythonMode
|
||||
Plik binarny nie jest wyświetlany.
|
Po Szerokość: | Wysokość: | Rozmiar: 210 KiB |
|
|
@ -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[:] = []
|
||||
Ładowanie…
Reference in New Issue