I'm working on a glowing effect for images. To make the glow more than one colour, I'm actually making a pseudo-element copy of the image with a blur and saturation filter applied. This pseudo-element is created through the addition of a class to the image's div.
Now this is all well and good, but I'd like to transition the glow effect with an ease-out, however no matter where I put the transition attributes, I just can't seem to get it to work.
I've made a codepen to illustrate: https://codepen.io/anon/pen/eYGJGPG
function addGlow() {
document.getElementById('example').classList.toggle('mask')
}
.img {
height: fit-content;
width: fit-content;
display: block;
/* Doesn't transition */
transition: all 0.3s ease-out;
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
}
.go {
height: 400px;
width: 400px;
background: url("https://upload.wikimedia.org/wikipedia/commons/3/32/RGB_color_wheel_72.svg");
background-size: initial;
}
.mask::after {
content: "";
width: inherit;
height: inherit;
position: absolute;
background: inherit;
background-position: center center;
filter: blur(10px) saturate(3);
z-index: -1;
}
<div id="example" class="img go"></div>
<button onclick="addGlow()">Press</button>