processing / p5.js

p5.js is a client-side JS platform that empowers artists, designers, students, and anyone to learn to code and express themselves creatively on the web. It is based on the core principles of Processing. http://twitter.com/p5xjs —
http://p5js.org/
GNU Lesser General Public License v2.1
21.11k stars 3.22k forks source link

Add list support for `lerpColor` like other color functions #6954

Open RandomGamingDev opened 2 months ago

RandomGamingDev commented 2 months ago

Resolves #6953

Changes:

Adds list support to the lerpColor like other color functions. (I understand why this function doesn't support string based colors since you should know the actual value of the color when lerping between them, but adding list support is still definitely something that would be useful as seen in the referenced issue. However, if anyone thinks that adding string based color support to lerpColor as well would be preferred I'll add that to the PR.)

Screenshots of the change:

const red = [255, 0, 0];
const blue = [0, 255, 0];

function setup() {
  // These always worked
  fill(red);
  fill(blue);
  // This works now!
  lerpColor(red, blue, 0.5);
}

PR Checklist