kopia lustrzana https://github.com/villares/sketch-a-day
main
rodzic
43161331f6
commit
29fb4a876d
Plik binarny nie jest wyświetlany.
Po Szerokość: | Wysokość: | Rozmiar: 1.3 MiB |
|
@ -0,0 +1,26 @@
|
|||
from __future__ import division
|
||||
|
||||
def setup():
|
||||
size(400, 400)
|
||||
rectMode(CENTER)
|
||||
strokeWeight(3)
|
||||
noStroke()
|
||||
|
||||
def draw():
|
||||
background(240)
|
||||
xa, ya = 100, 100
|
||||
xb, yb = 300, 300
|
||||
ca = color(200, 0, 0, 100)
|
||||
cb = color(0, 0, 200, 100)
|
||||
sa = map(mouseY, 0, height, 10, 200)
|
||||
sb = 210 - sa
|
||||
n = 1+ int(mouseX / 10)
|
||||
for t in range(n + 1):
|
||||
xc = lerp(xa, xb, t / n)
|
||||
yc = lerp(ya, yb, t / n)
|
||||
cc = lerpColor(ca, cb, t / n)
|
||||
sc = lerp(sa, sb, t / n)
|
||||
fill(cc)
|
||||
rect(xc, yc, sc, sc)
|
||||
|
||||
|
|
@ -16,6 +16,13 @@ You may also support my artistic work, open educational resources and research u
|
|||
|
||||
## 2020
|
||||
|
||||
---
|
||||
|
||||

|
||||
|
||||
[sketch_2020_05_23a](https://github.com/villares/sketch-a-day/tree/master/2020/sketch_2020_05_23a) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]
|
||||
|
||||
`map()`, `lerp()` and `lerpColor()` example
|
||||
|
||||
---
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue