I have a sketch on loop but want to test out different colors and sizes via p5gui quickly. Redraw seems to require noLoop(). What can i do to trigger a redraw despite the loop and select from a list of colors and sizes? Thanks.
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
circle(200,200,200*sin(millis()/1000))
}
function mousePressed() {
redraw();
}
actually not exactly understood what you’re trying to achieve. As @Chrisir stated above the draw function is called continuously by the standard setup.
Do you maybe looking for s.th. like this ?
Cheers
— mnse
let size;
let colr;
function setup() {
createCanvas(400, 400);
noStroke();
}
function update() {
size = random(10, width >> 1);
push();
colorMode(HSB, 1, 1, 1);
colr = color(random(), 1, 1);
pop();
}
function draw() {
background(220);
update();
fill(colr);
circle(width >> 1, height >> 1, size);
noLoop();
}
function mousePressed() {
loop();
}