-
Notifications
You must be signed in to change notification settings - Fork 705
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
[scroll-animations-1] Transition delays in scroll-linked animations #7059
Comments
The CSS Working Group just discussed The full IRC log of that discussion<TabAtkins> Topic: transition delays in scroll-linked animations<TabAtkins> github: https://github.com//issues/7059 <TabAtkins> flackr: in reponse to smfr comment, many scroll-linked aniamtions today don't immediately update to the scroll position, they have a delay in time <TabAtkins> flackr: whether that's due to ipml issues is an open question <dbaron> s/ipml/implementation/ <TabAtkins> flackr: in order to support this, could add something similar to transitions, where the timeline would target the currnet scroll position, but take an easing function to progress to it <TabAtkins> flackr: I put together a jsbin to show off constructing this with a custom prop and some jS <bramus> https://jsbin.com/qekodug/edit?css,js,output <TabAtkins> flackr: so should we do this now, and if so do the properties make sense, or do this as a l2 feature? <TabAtkins> fantasai: suggest we wait for smfr, suspect he'll have an opinion <bramus> q+ <TabAtkins> fantasai: re: level, seems easy to defer, so maybe level 2? but we dont' have an fpwd of l1 yet, so we can include it and split it later if needed <bramus> q- <TabAtkins> ydaniv: you might be able to do some of this now with easing, or like the new linear() function <TabAtkins> flackr: you can't do this using any existing easing function - right now, if you scroll to a position we immediately update the time to match the position <TabAtkins> flackr: you can use easing to control how you respond to time, but you can't delay the update <TabAtkins> flackr: if smfr shows up today, i'd love to get this in if possible <TabAtkins> astearns: so let's table for now and see if we can get simon on the call today |
It feels like adding Logically, it feels to me like the best approach is to allow authors to link "timeline modifiers" together in a list, where each modifier can alter the delay, rate and offset of the input progress, and output a new progress. This feels like it should be a new feature of the Web Animations API, rather than being bolted onto scroll timelines. |
So to put it in more concrete terms, would the author create a new timeline which modifies an existing one? E.g. You might create something like a element.animate(parallaxKeyframes, {
timeline: new DelayedTimeline(new ScrollTimeline(), {ease: 'ease'})
}); or in css: #target {
animation: parallax delayed(scroll() 500ms ease);
} |
Though I think the TLDR is that such an approach would be an improvement to animations support generally rather than part of scroll-animations-1. If so, should we close / repurpose this to be e.g. web-animations-2? |
That's not an issue here since in*-linked animations, as opposed to time-based animations, the duration is always 100%, and the delay is just an offset of the start. So, there's nothing to reason about here, it's just an extra interpolation between last value and the current one, described by a transition. If it's not clear, I'll try to quickly create a demo. Your suggestion for progress modifiers sounds like it's taking the same idea, but allowing authrs to provide a custom function for the easing. So might as well use |
FWIW I wrote a demo of this in the initial post (by setting a custom var to the scroll progress and applying a transition on it): It is exactly as you say, a transition from the old scroll / time value to the new scroll / time value, the same as transitions work. |
I'd like to take a shot at revisiting this issue, because this pattern is used quite often. I think we can take a different angle at this, by defining a friction factor to the interpolation on each frame between last and current positions, instead of having a transition with a defined duration on the animation, which is in fact the implicit way of calculating this factor. Friction is actually The way the Applying easing on this effect is less common. Since the lerp already provides a nice curve, adding an extra easing on top is a bit redundant, but may be possible, I'm not quite sure yet whether this should be expressed in the interpolation function (i.e. instead of a simple lerp) or perhaps in some other way, modifying the progress that is calculated by it. Still an open question, if we consider the above, is if/how we can expose a declarative syntax/API for this. |
I read through the issue but I'm not sure I quite follow where / how the friction factor is applied or where the |
@birtles ok, here's a demo of what I mean: https://codepen.io/ydaniv/pen/VwBojoN Now that I'm looking at it, I'm not sure I'm convinced myself, since the effect is sort of exponential in relation to the |
@birtles @flackr @fantasai |
Copying out @flackr's comment #6674 (comment)
The text was updated successfully, but these errors were encountered: