canvas.stop() p5 code example Example: how to make an object stop at the end of your canvas p5js y = constrain(y, 0, 570);