\

Tw-fade: pure CSS scroll-driven edge masking

41 points - last Monday at 3:12 PM

Source
  • Stitch4223

    today at 6:09 PM

    What is happening here and why is it special? The site itself does show, but does not tell (which in itself is somewhat refreshing).

    • chrismorgan

      today at 5:20 PM

      The fade affects scroll bars, which is quite unpleasant (and arguably catastrophic if you have two-dimensional scrolling). The traditional background-image technique avoided this by sitting inside the scroll area. I don’t think you can achieve that with mask, without an additional element. But I think it might be worth that extra element.

      • Hugsbox

        today at 4:37 PM

        This is extremely laggy on my computer. It may not be a top-end gaming supercomputer but it's no slouch either.

          • sheept

            today at 5:18 PM

            It might be related to the liquid glass imitation in the color scheme picker

              • bduffany

                today at 6:06 PM

                I think you're right. Performance profile shows lots of long spans relating to that element, and deleting that element makes the page scroll much more smoothly.

                There are still other issues though. The performance of this page feels pretty bad in general.

        • petekp

          last Monday at 3:12 PM

          hey all, just released a plugin to scratch an itch. i'd been lazily adding linear gradients on the edges of scrollviews and animating them with JS based on scroll position. turns out you can do a lot better with pure CSS now by leveraging masking + the new CSS scroll animations API.

          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.

          • maxjustus

            today at 5:15 PM

            I also love the pure CSS parallax effect of the "tw-fade" title shadow using multiple spans with different styles that fade in and out based on scroll position. Very clever!

            • jstanley

              today at 4:10 PM

              FYI scrolling this page is slow as balls on my computer. Firefox on Ubuntu.

              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.

                • RyanOD

                  today at 5:14 PM

                  I was wondering the same thing and I'm in Chrome. The "Horizontal" and "Vertical" sections don't seem to do anything, but maybe I'm just not understanding what I should be looking for?

                  • rtrigoso

                    today at 4:20 PM

                    This has a frame drop issue on Chrome Version 149.0.7827.156. It isn't close to smooth on my browser.

                • ptak

                  today at 4:55 PM

                  Neat! I'd much rather just copy-paste the CSS from the site though, would never install something like this as a package.

                • f8ght

                  today at 4:57 PM

                  [dead]

                  • NooneAtAll3

                    today at 4:29 PM

                    arrow keys don't work, pgdown doesn't work

                      • c-hendricks

                        today at 5:22 PM

                        I don't think that would be an issue of this CSS, that's just normal `overflow: auto` behaviour.

                        • k33n

                          today at 4:31 PM

                          pgdown works for me (firefox on linux)

                          arrow keys also seem to work fine but you have to click-to-focus first.