My code is "crashing" the editor. What is wrong?

I made a code for a magnifier glass in p5.js. It works but the editor shuts down after a short time. Can someone please look at it and see what is wrong? The code in p5.js editor

1 Like
1 Like

Thank you! Do you have an example how I could rewrite my code? I am not so good at this yet :scream:

following @GoToLoop 's tip:
just move the line

	magni = createGraphics(400, 400);

up to setup and it works

1 Like

If I move magni = createGraphics(400, 400); to setup the magnifier circle draws a trail to the canvas when I move it.

do as kll said but add magni.clear() to the draw


Thank you so much!! Now it is working!!:smiling_face_with_three_hearts: