This is the Menger sponge.
well this is MY Menger sponge in P5.js. My Code Demo (NOTE: you need WebGL or this won’t work for ya!)
If you have Flash installed, this is one old portfolio interface I made and never finished. I started to make it in css3 but never followed through with that. Check it out here!
I’ve seen Menger sponges before but never knew what it was called. I also didn’t really every thing about recreating it. It is Daniels coding challenge number 2 and an opportunity for me to get to know some basics of p5.js’ 3d system/webgl.
This is Daniels original done in Processing. I still don’t know Processing so I’ll be doing this in JS.
Yes I know that Daniel will recreate things in both Processing and in P5. I’m doing my best to not look at his code or conversions outside of what is in his videos. (Which if you watch the livestreams, is way too much information. It’s still fun to watch though!)
P5 makes 3d primitives pretty easy but they alter the coordinate system from 2D. While this make sense it really threw me off.
Everything fell together with simple logic and class structure. The pop and push before translating also threw me off. Granted I remember having to do these before when I messed with Canvas, it still feels out of place in closure/scope. ‘Works as designed’, right?
I will note that I limited my ‘divisions’ to 3 mouse presses as that is where JS seems to just about call it quits. I do want to learn this in Processing now because I do enjoy things like this.
My Code Demo (NOTE: you need WebGL or this won’t work for ya!)
As always, thank you to Daniel!
clean phil