Widget Wednesdays #25

For this week’s Widget Wednesday I decided to go with a classic exercise in computer graphics: Use a 2D rendering substrate to show something in 3D.

In particular, I’m simulating 1000 particles roiling around within a 3D sphere. But I’m using canvas2D to do it, and canvas2D is usually used for rendering 2D things, not 3D things.

The magic sauce here is that at every animation frame I sort everything from back to front. That’s because in order to make things look right, I need to paint each object on top of the previous one, to create the proper illusion of 3D depth.

You can check it out here.

Leave a Reply

Your email address will not be published. Required fields are marked *