I want to run the startDraw()
function when I press a key, and have it run constantly after the key is pressed. I tried to use the if(mouseIsPressed)
statement, and the mousePressed()
function that is predefined in p5.js, however it only runs the startDraw()
function for less than 1 second (the time that the key is pressed).
function draw(){
background(220);
startDraw();
}
For instance:
function draw(){
if (mouseIsPressed) {
startDraw();
}
}
This only works for the duration of the period that a key is pressed, not afterwards.