Show HN: CSS generator for a high-def glass effect (opens in a new tab)glass3d.dev
420 pointsCross-browser compatibility is actually the reason I rely on ::before and ::after pseudo-elements to build up the effect. Move the color/opacity to the main element, and you’ll get weird color bleed on the corners in Chrome. Move the texture, and it muddles the bevel’s specular highlight. Move the bevel, and it gets blurred out by the backdrop-filter. And so on!
Layers include:
* Adjustable blur, brightness, and saturation (backdrop-filter)
* Subtle translucent texture
* Faux 3D bevel (using box-shadows, not an outline)
Glassmorphism is rather heavy on resources, so it’s best used as an accent and avoided on wide desktop elements.
Should be compatible with recent versions of Chrome, Safari, and Firefox (desktop and mobile). If you spot bugs or rendering glitches, I’d love to know!
Side note: this is an early preview of a framework-agnostic glass SCSS/component library I’m building.
Comments (117) 32 threads
Earlier comments/* This is mostly intended for prototyping; please download the pattern and re-host for production environments. Thank you! */
It shows, this is awesome, especially that rice paper effect!
This is a slight tangent, but 20 years ago I had a nightmare in which I got hit by a tram, died and travelled in time into a world where every computer was running Windows Vista. In other words, fair enough, you might be onto something here after all.
I've never used OSX, but I would guess from screenshots that it didn't do dynamic layered gaussian blur of large screen regions in realtime, which would've been too much for the hardware of the year 2000.
Also, those scrollbars were quite impressive for their time.
Continue this thread — 1 reply
Even so, I haven't found another glass generator that has a texture layer and box-shadow bevel, etc.
All comments shown.
Couldn't load more comments. Check your connection and try again.