Re: [csswg-drafts] [scroll-animations-1][css-animations-2] Out-of-range range offsets (#8578)

> If we could have something that behaves like `min(0px, entry 0%)` that would allow this clamping, but this depends on what we resolve in #8672.

Does it depend on #8672? Can't you specify all possibilities using the longhands?

> If we allow `<length-percentage>` to resolve to an absolute offset then we could allow authors to achieve that without any additional syntax.

Using absolute offsets is already supported by spec using the non-named-range `<length-percentage>` version of `animation-range` on a scroll timeline. https://www.w3.org/TR/scroll-animations-1/#animation-range-start

There's an [open bug](https://bugs.chromium.org/p/chromium/issues/detail?id=1441013) to get this working in chromium's implementation.

Maybe we should revisit the range of view-timeline and make it so that it can reference ranges over the entire scroll which I think would directly support your use case, e.g.
```css
.target {
  /* Animate from initial scroll position to exit. */
  animation-range-start: 0px;
  animation-range-end: exit 100%;
}
```

Or if we want to allow for the start phase to be later than 0px,
```css
.target {
  /* Animate from initial scroll position to exit. */
  animation-range-start: max(0px, entry 0%);
  animation-range-end: exit 100%;
}
```

> Another issue with something like using min(entry 0%, contain 100%) for start in first fold, for example, is that it will just choose the lowest between the two, and not really interpolate and map the 0% progress to the actual starting point of the range.

If the keyframes are not specified in terms of range attachment points, they will map to the entire range name, so a 0% keyframe will occur at the result of this range calculation.

-- 
GitHub Notification of comment by flackr
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8578#issuecomment-1540705525 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 9 May 2023 18:43:45 UTC