diff --git a/2020/sketch_2020_05_23a/sketch_2020_05_23a.gif b/2020/sketch_2020_05_23a/sketch_2020_05_23a.gif new file mode 100644 index 00000000..4aa14a1e Binary files /dev/null and b/2020/sketch_2020_05_23a/sketch_2020_05_23a.gif differ diff --git a/2020/sketch_2020_05_23a/sketch_2020_05_23a.pyde b/2020/sketch_2020_05_23a/sketch_2020_05_23a.pyde new file mode 100644 index 00000000..3f5047c0 --- /dev/null +++ b/2020/sketch_2020_05_23a/sketch_2020_05_23a.pyde @@ -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) + + diff --git a/README.md b/README.md index 7e14c53c..2e38e652 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,13 @@ You may also support my artistic work, open educational resources and research u ## 2020 +--- + +![sketch_2020_05_23a](2020/sketch_2020_05_23a/sketch_2020_05_23a.gif) + +[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 ---