None
EN
Comment on Solved by CSS Scroll-Driven Animations: Style an element based on the active Scroll Direction and Scroll Speed by Event Notes: btconf Düsseldorf 2025 - Steve Rudolfi
['View More Posts', 'Published Bramus', 'Bramus Is A Frontend Web Developer Belgium', 'Working As A Chrome Developer Relations Engineer At Google. The Moment He Discovered View-Source At The Age Of']
Comments for Bram.us
# The Code If you’re here for just the code, here it is: @property --scroll-position { syntax: "<number>"; inherits: true; initial-value: 0; } @property --scroll-position-delayed { syntax: "<number>"; inherits: true; initial-value: 0; } @keyframes adjust-pos { to { --scroll-position: 1; --scroll-position-delayed: 1; } } :root { animation: adjust-pos linear both; animation-timeline: scroll(root); } body { transition: --scroll-position-delayed 0.15s linear; --scroll-velocity: calc(var(--scroll-position) - var(--scroll-position-delayed)); --scroll-speed: max(var(--scroll-velocity), -1 * var(--scroll-velocity)); /* abs(var(--scroll-velocity)); */ --scroll-direction: calc(var(--scroll-velocity) / var(--scroll-speed)); /* sign(var(--scroll-velocity)); */ --when-scrolling:…