-
Notifications
You must be signed in to change notification settings - Fork 669
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
[web-animations-1] Drop the *ReadOnly interfaces #2068
Comments
From @alancutter on April 7, 2017 6:58 What happens when you do const animation = div.getAnimations()[0];
animation.effect.setTimingProperty({ duration: 3000 });
div.style.animationDuration = '4s'; under this new scheme? |
I think you're saying you want to override the duration so we should ignore the value coming from the cascade for that property. That is, the duration is 3s. (But this isn't so much a concrete proposal as a memo that we should double-check the *ReadOnly approach is the one we want before we ship.) |
From @alancutter on April 10, 2017 4:15 Looking at your example of the current interfaces:
The current *ReadOnly design seems to only cover most but not all aspects of overriding the cascade. A completely read only design wouldn't allow you to modify I would be in favour of all or nothing rather than the current semi-read only design. |
I think what you're saying is that the current setup lets you override the effect but doesn't let you restore it unless you hold onto the old effect? I think we definitely want to allow modifying generated CSS animations/transitions. That's important for extending those functions (e.g. by making a CSS transition that goes via some intermediate state, or making a transition on one property update another property too--all the while still allowing those transitions to be cancelled in the normal way). The question is just about the mechanism we use to allow overriding. Is it a "break the connection once" interaction, or a property-by-property override. |
Yes. This is currently blocked on #2065 which I hope to get to in the next couple of weeks. |
Thinking aloud, what if:
const clone = new KeyframeEffect(
src.target,
Object.assign(src.getTiming(), {
composite: src.composite,
iterationComposite: src.iterationComposite,
}),
src.getKeyframes()
); Which is complex enough that it's probably worth adding this. |
I really like your latest proposal @birtles. It feels natural to me as a (mostly) JS developer, once you've written one property, the link is gone and it's all JS from now on. This embraces one of the core benefits of the Web Animations API, which is that there is now an explicit, typed and easy-to-use API to program animations, where the CSSOM was just not a convenient way to do this before. Curious to see what Google folks think, but this feels right. |
This makes sense to me as well, though as I mentioned on #2065 I feel it is slightly more idiomatic to have a modifiable object of override properties - as it's roughly equivalent to what developers have with CSS style, inline style and computed style. That being said, it's probably not worth the complexity it would add. |
Closed by 953041f |
From @birtles on April 7, 2017 6:27
Originally we introduced the *ReadOnly interfaces for CSS. The logic went something like this:
However, in #168 I'm proposing we simplify the timing interfaces to have only:
The last one is basically equivalent to:
I'm now wondering if there's some way we can exploit this setup (and similarly
setKeyframes()
) to signal which properties you want to override. Perhaps we could change the timing dictionary to have default values which we interpret as the initial value for script-generated animations and the style-specified value for CSS animations/transitions such thatsetTiming()
resets everything?That would certainly be nicer for authors: being able to override the delay of a single instance of a CSS animation programmatically is certainly something I've wanted to do, and it would be nice not to have to completely divorce it from style changes in order to do so. It would also avoid some of the confusion and complexity around the *ReadOnly interfaces so it's probably worth considering at least.
Copied from original issue: w3c/web-animations#185
The text was updated successfully, but these errors were encountered: