Closed villares closed 4 years ago
Precisa explicar...
from __future__ import division # usando divisão do Python 3 def setup(): size(500, 500) def draw(): background(200) noStroke() dots(width / 2, height / 2, mouseX , mouseY, color(255, 255, 0), color(0, 255, 255), steps=20, dot_size=10) def dots(x1, y1, x2, y2, ca, cb, steps=10, dot_size=10): L = dist(x1, y1, x2, y2) A = atan2(x1 - x2, y2 - y1) pushMatrix() translate(x1, y1) rotate(A) if L < steps * dot_size: steps = int(L / dot_size) for i in range(steps + 1): y = 0 if steps > 0: p = i / steps y = lerp(0, L, p) cor = lerpColor(ca, cb, p) fill(cor) rectMode(CENTER) rect(0, y, dot_size, dot_size) popMatrix()
https://github.com/villares/material-aulas/blob/master/Processing-Python/map_lerp.md
Precisa explicar...![image](https://user-images.githubusercontent.com/3694604/79641350-596dae00-816d-11ea-8745-4c9c894eeda4.png)