Skip to content

[scroll-animations] Unclamped start and end element-based offsets are hard to work with #4327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
flackr opened this issue Sep 18, 2019 · 2 comments

Comments

@flackr
Copy link
Contributor

flackr commented Sep 18, 2019

This issue is separating out a particular concern in https://github.com/WICG/scroll-animations/issues/51 where offsets can be outside the scrollable range which means that your animation will start partway through, a distance depending on the geometry of the page. In https://flackr.github.io/scroll-timeline/demo/parallax/unclamped.html you can see that this has made animations at the start and end of the scroller start / end partway through the animation.

I think as a developer this unclamped behavior is hard to reason about (i.e. I have to use a different parallax boundary for elements which start on screen from those which scroll into view - but that's dependent on the size of the viewport). This seems to eliminate some of the benefits of element-based offsets as the developer has to again worry about resizing / shifting of elements.

I think that we should clamp offsets outside of the scroll range (as in https://flackr.github.io/scroll-timeline/demo/parallax/ ) for better developer ergonomics.

@majido
Copy link
Contributor

majido commented May 26, 2020

I agree that the unclamped behavior is hard to reason about and perhaps unexpected.

Let's default to clamped behavior and in future it is easy to expose a method for authors to explicitly ask for unclamped behavior.

@majido
Copy link
Contributor

majido commented Jun 1, 2020

The element-based offset has been added to the specification. And the current specified behavior is to clamp the offset. Considering this fixed.

  1. Clamp the value of scroll offset to be within the {{source}}'s
    scroll range.

@majido majido closed this as completed Jun 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants