-
Notifications
You must be signed in to change notification settings - Fork 689
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
Split CSS event bindings from application #4343
Comments
Thanks for your feedback. I think it would be a little more easy to process, however, by describing the particular use cases that are problematic. Also, in the sample code, it seems like there are three places ( |
There are numerous ideas in this thread, sorry it’s probably confusing. I couldn’t figure out how to break them down more. Hopefully this makes sense though? |
Here’s a quick example of CSS keyframes bound to scroll with today’s CSS: https://codepen.io/scottkellum/pen/WWeXab?editors=1100 I think this spec makes it a little easier to achieve the code above. That said, having played with this technique for a while I’ve found
|
Thanks for all of the details here.
Issue #7575 proposed this idea as well as a way of bringing back scroll offsets to the API. I think this could be reasonable. I propose we keep the discussion there since there are a few other issues in this one.
I don't think this part would be part of the scroll-animations-1 spec. While possible, this would implicitly create animations through direct style values, which would likely be difficult for engines to optimize (e.g. it's less clear if used in a calc whether a scroll change can be directly mapped to output style). Though you can still do this more explicitly by animating a custom property with a scroll linked animation and using that custom property in other calculations, and in this case there is an explicit animation running.
This seems reasonable. We have already moved away from time and are currently using percentages, but there's some discussion in #4342 about this and would play well with the plan in #7044 to allow specifying delay and end delays relative to phases (we could add lengths). |
Thanks for the updates @flackr! Some more notes on this from other angles as things have progressed in the past 3 years elsewhere: The language seems to be moving away from “animation” to the more appropriately abstracted “interpolation”. IE “Interpolation timelines” sources: |
It would be ideal to have animations handle more arbitrary units. Such as units other than time like length, as an input. Inputs might be handled from some sort of event API within CSS. There are ways, by using animation delays, to hack this feature, but there are ways to make things more elegant that would make life easier both in animations and outside of animations.
What this might look like for scroll:
This also frees you up to bind to other things, like viewport width, element width, device orientation, ambient light, video progress, range sliders, etc…
What is the output of scroll functions and how can they be isolated from animations?
with something like this:
scroll(element(#container), vertical, "300px", "500px")
Can this be used outside of a timeline? For example, could I attach this to a property inside of
calc()
and at400px
have it return.5
? What are the advantages of making this a new thing vs attaching these bindings to animation delay? I see a lot of value here for things beyond animations and animations themselves can already handle rebinding of timeline. The timeline syntax is much nicer but I’m curious if there are going to be conflicts within the animation value.Binding keyframes to scroll in today’s CSS:
It’s exciting to see this spec as I have prototyped a lot of this functionality in today’s CSS. Here is what scroll depth would look like with
animation: keyframes 1s linear 1 calc(-1s*var(--depth)/var(--max-depth)) paused;
And this library surfaces JS events to CSS so you can feed them into things like the animation above: https://github.com/scottkellum/momentum
typetura.js binds to the viewport, and with a slight modification it can bind to scroll depth: https://github.com/typetura/typetura.js#starting-with-the-basics
The text was updated successfully, but these errors were encountered: