We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm trying to implement color into a sketch, and keep getting the error message "Uncaught ReferenceError: color is not defined". I tried a simple sketch from the reference page and still got the same error:
var c = color(255, 204, 0);
function setup() {
createCanvas (800, 800);
noStroke();
}
function draw() {
fill(c);
ellipse(mouseX, mouseY, 80, 80);
}
I'm running the p5 editor on Windows 10, if that helps at all
Answers
p5 functions aren't defined outside of setup and draw. it's best to declare variables outside setup, and assign them inside setup.
Fantastic, thanks Lauren!