Logic on making a circle disappear when clicked and drawing another circle at the same time

good exercise and research for you

Seriously, when you want to have real help on this, translate into p5js and post the link to your attempt here

Hi @Chrisir , indeed it was a good research and exercise. I have put the p5 version of it linked below

Right now I am trying to figure how to make the explosion go radially outwards ( to have a more natural movement ) and perhaps to explode into smaller cubes instead of squares.

T

1 Like

That’s done
By the two vel variables in the class

Thanks , yes i noticed that but i thought of adding more variance but maybe later. :blush:

I am currently trying to figure out a way to have the explosions occur on top of a webcam feed instead of having it on the canvas. I think the way forward is to use createGraphics function . not sure at the moment , perhaps would need investigation .

1 Like

Hi , I read up and found that in order to draw on different canvases one needs to use create graphics method to do so . I tried to extend the logic : Explore when the mouse is inside the cube to draw on top of a webcam feed but it does not seem to work .

From wikipage : Getting started with WebGL in p5 · processing/p5.js Wiki · GitHub
I had translated the co-ordinate system from the WEBGL sketch , that is the origin being at the center as compared to the 2D canvas which is on top left.

However when i run the sketch , I can see that the mouse is being clicked inside the cube but it only explodes in the first instance but not later . The distance computer seems to be wrong . It seemed to have worked perfectly for the 2d sketch but not when introducing a webcam feed. So i am a bit confused as in what is wrong
Sketch to the webcam feed ( exploisions not working ) : p5.js Web Editor

I think it could something fundamentally wrong in approaching the problem .