Having read the documentation on the p5.js site, I’m still a little confused as to how to use the redraw() function and the loop function. What I’m trying to achieve is something which allows me to stop the draw function if the mouse has been still for a certain amount of time, and to loop again only if mouse is moved. The issue is that if I create a if statement style scenario in a function called in in draw ie;
the alternative being to call redraw or loop in mouseMoved() however this causes the animation to not be fluid, Has anybody found an acceptable solution to this.
let x = 0;
function setup() {
createCanvas(100, 100);
noLoop();
}
function draw() {
background(204);
line(x, 0, x, height);
}
function mouseMoved() {
x += 1;
if ( x > width ) x = 0;
redraw();
}