xxxxxxxxxx
31
let textColors = [[255,0,0],[0,255,0],[0,0,255]];
let pickedColor = 0;
function setup() {
createCanvas(400, 400);
}
function draw(){
if (pickedColor == 0) {
textColor = textColors[0];
} else if (pickedColor == 1) {
textColor = textColors[1];
}else if (pickedColor == 2) {
textColor = textColors[2];
}
fill(textColor);
textSize(100);
text("hello",100,100);
console.log(pickedColor);
}
function mousePressed() {
pickedColor = pickedColor + 1;
if (pickedColor > 2) {
pickedColor = 0;
}
}