lerpColor() demands that its 1st & 2nd passed arguments to be of p5.Color datatype:
If options.Foreground & options.Background are an array or a number or even a color string, you can convert them to a p5.Color datatype by passing them as an argument for color() :
Extra info about p5.Color :
So, what if I wanted to dynamically change each individual rgba argument of color(), can I say this.col.r = 200; , or some equivalent?
let btn;
function setup() {
createCanvas(400, 400);
btn = new Btn(color(50, 127, 219, 255));
}
function draw() {
clear();
btn.run();
}
class Btn {
constructor(_col) {
this.col = _col;
this.pos = createVector(width >> 1, height >> 1);
this.r = 33;
}
display() {
if (this.hover()) {
fill(this.col, this.col.a); // this is ignoring alpha
if (…
2 Likes