Created
February 1, 2021 09:22
-
-
Save DarkWiiPlayer/bb82379d71740c8d73c67771c4f33f34 to your computer and use it in GitHub Desktop.
A somewhat nicer frosted glass effect using SVG filters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let template = document.createElement("template") | |
template.innerHTML = ` | |
<svg> | |
<defs> | |
<filter id="zoom"> | |
<feTurbulence type="turbulence" baseFrequency="0.05" numOctaves="2" /> | |
<feGaussianBlur in="distorted" stdDeviation="2" result="turbulence" /> | |
<feDisplacementMap in2="turbulence" in="SourceGraphic" scale="10" xChannelSelector="R" yChannelSelector="G" result="distorted"/> | |
<feGaussianBlur in="distorted" stdDeviation="2" /> | |
<feColorMatrix type="matrix" values=" | |
.98 0 0 0 0 | |
0 1 0 0 0 | |
.02 .02 1 0 0 | |
0 0 0 1 0" /> | |
</filter> | |
</defs> | |
</svg> | |
<div style="position: fixed; left: 0rem; top: 0rem; bottom: 0rem; right: 0rem; pointer-events: none; z-index: 99; backdrop-filter: url(#zoom)"></div> | |
` | |
document | |
.querySelector("body") | |
.appendChild(template.content.cloneNode(true)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment