Doing it raw, you'd just set the filter in css
filter: brightness(0.75) blur(var(--current-blur, 0px));
And the javascript would be
document.addEventListener("DOMContentLoaded", function() { const heroSection = document.querySelector(".hero"); const heroHeight = heroSection.offsetHeight; // We want the blur to go from 0px up to 35px // once we've scrolled the full hero height. const maxBlur = 35; // Select the .bg container (our pseudo-element is inside it) const bg = document.querySelector(".bg"); window.addEventListener("scroll", () => { const scrollY = window.scrollY; // 0..1 progress from top of page to bottom of hero let progress = scrollY / heroHeight; if (progress < 0) progress = 0; if (progress > 1) progress = 1; const currentBlur = maxBlur * progress; // We'll store that in a CSS variable for the pseudo-element bg.style.setProperty("--current-blur", `${currentBlur}px`); }); });
Now, as you scroll, the background image would progressively get blurred. How to do this in webstudio?
filter: brightness(0.75) blur(var(--current-blur, 0px));
what do you mean by add that class to the hero? where do I add it in the Webstudio UI? thanks a lot
Hey, sorry for sounding dense, but can I trouble you for step by step instructions and full names of the parts of the webstudio app where I need to do this?
Thanks a lot.