works in pretty much all browers excepting firefox which doesn't have CSS scroll animations yet, but the nightly version does, so it should be generally available soon.
demo site: https://pete.design/tw-fade
github: https://github.com/petekp/tw-fade
npmjs: https://www.npmjs.com/package/tw-fade
if you use it i'd love to hear how it goes and if you have any feedback.
I don't know if this page is a demonstration of your plugin, I'm guessing yes but I can't see any masking going on, it seems to scroll just like a normal page but much more laggy.
EDIT: Oh I see in your comment now, it doesn't work in Firefox. My mistake.
arrow keys also seem to work fine but you have to click-to-focus first.
There are still other issues though. The performance of this page feels pretty bad in general.
Plugin for Tailwind CSS v4
Elegant, scroll-driven edge masking. One class. Zero JavaScript.
npm i tw-fade
fade-xfade-yhey! finally trying tw-fade π
oh nice β welcome
these scroll lists are slick
thanks, itβs all CSS
this thread fades at the edges while i scroll π
thatβs tw-fade β¨
some scroll library?
nope β a pure CSS mask
zero JavaScript
so how does it know iβm scrolling?
scroll-driven CSS β the fade is scroll-gated
does it soften both edges?
fade-y β one class on the container
but the newest message stays sharp π₯
pinned to the bottom, yep β scroll up and both edges dissolve βοΈ
fade-xy fade-size-2xl fade-range-mdPeripheral impermanence
Peripheral impermanence
Peripheral impermanence
Peripheral impermanence
Peripheral impermanence
Peripheral impermanence
Peripheral impermanence
Peripheral impermanence
Peripheral impermanence
Peripheral impermanence
Peripheral impermanence
Fade size
2xl
Scroll range
2xl
Edges
Fades appear only when there is more content to scroll, then ease away again at either edge.
Eased alpha ramps dissolve content into the surface instead of ending on a clipped line.
Axis, size, range, and clear-zone utilities compose directly on the scroll container.
Dissolve Recede Soften Vanish Fade Blur Ghost Diffuse Eclipse Ebb