Хорошо, вот способ сделать это, используя radial-gradient()
как mask-image
.
var h1 = document.getElementById('masked');
document.addEventListener('mousemove', mouseListen, false);
function mouseListen(e){
setMaskPos(e.clientX,e.clientY);
}
function setMaskPos(x,y) {
h1.setAttribute("style", "-webkit-mask-image: radial-gradient(circle at " + x + "px " + y + "px, black 0px, black 200px, transparent 250px)");
}
// Initialise the mask off screen
setMaskPos(-999,0);
.wrapper {
display: flex;
justify-content: center;
align-items: center;
position: relative;
}
.h1, blur {
width: 100vw;
height: 100vh;
}
.h1 {
position: absolute;
top: 0;
left: 0;
margin: 0;
padding: 0;
font-size: 4em;
background-color: white;
}
.blur {
position: absolute;
top: 0;
left: 0;
margin: 0;
padding: 0;
font-size: 4em;
background-color: white;
filter: blur(8px)
}
<div class="wrapper">
<h1 class="blur">
Our principles inform everything we do. Whether you're preparing content, designing an interface or developing an entire service, start by reading these.
</h1>
<h1 id="masked" class="h1">
Our principles inform everything we do. Whether you're preparing content, designing an interface or developing an entire service, start by reading these.
</h1>
</div>