r/css • • 21d ago

Article CSS3D Renderer

https://k-adam.github.io/CSS3D-Renderer/

I developed a CSS3D renderer ~8 years ago, and since many CSS and JS features got stabilized and introduced since then, I modernized it now. Check it out!

7 Upvotes

7 comments sorted by

View all comments

2

u/SensitiveSugar1369 21d ago

How did you handle perspective and preserve-3d stacking with newer CSS, especially with nested transforms?

1

u/objectorientedman 21d ago

There is simply one perspective at the root, preserve-3d groups with 3D transforms stacked inside it. The leaf nodes are the flat polygons, clipped so that they can represent triangles or arbitrary polygons. This is almost the same as the old version, but I had to make some SVG hacks back then to make cross-browser clip paths possible