flackr / scroll-timeline

A polyfill of ScrollTimeline.
Apache License 2.0
951 stars 92 forks source link

Parse full animation-range syntax #251

Open johannesodland opened 7 months ago

johannesodland commented 7 months ago

Implements parsing the full animation-range syntax to fix https://github.com/flackr/scroll-timeline/issues/236

Changes:

The tests for animation-range are not strictly unit tests and tests the implementation through the internal parseAnimationRange() function. The functionality is currently only exposed through css parsing which makes it difficult to test. We could expose the parsing partly through CSSStyleValue.parse('animation-range', value) but then we would have to proxy that method in all browsers.

calinoracation commented 5 months ago

Edit: Nevermind, our atomic css parser split the rules out so it couldn't parse it correctly.

~@bramus @johannesodland Any chance of landing this? We're trying to use some code like this and it's not parsing at the moment. In Chromium it works great.~

    animation-duration: 1ms;
    animation-fill-mode: forwards;
    animation-name: overflow-visible;
    animation-range-start: entry 70%;
    animation-range-end: entry 100%;
    animation-timeline: --carousel-scroller;
    view-timeline-name: --carousel-scroller;

    @keyframes overflow-visible {
      from {
        opacity: 1;
      }
      to {
        opacity: 0;
      }
    }