I'm experimenting with something like this:
let str = 10;
let blu = "px";
let val = "";
function check() {
if(a < b){
str = str - 6;
if (str<0){str = 0}
val = str+blu;
document.getElementById("img1").`style.filter = 'blur(val)';
}
The value of 'str' and therefore 'val' changes every time the function 'check' is executed, but 'blur(val)' results in an error.
I was under the impression that a variable could be used here. I also attempted using setProperty.
document.getElementById("img1").style.setProperty("blur", val);
but this also led to an error.
What would be the solution? Also, how can you gradually reduce the blur effect on text or an image based on a timer? For instance, if the initial blur is set to 60px, reduce the blur by 1px every second so that after 1 minute, the entire text becomes clear?