Comments (3)
There is two part this proposal:
- Make one timeline a primary timeline.
- Allow animation to explicitly attach/detach to timelines.
I support both these ideas but let me add more color to the discussion.
A Primary Timeline
The main benefit here is that it will make integration with Web Animation much simpler. For example it is now clear what is the time value that will be used in the animation events i.e., event timeline time.
Explicit Timeline Attach/Detach
Our previous design was passing multiple timelines to the animation. An issue with that design is that the animation needed to be updated anytime any of its timelines has changed. However, this is inefficient in many common usecases. Take for example the โhidy barโ effect where the animation initially tracks the scroll offset (via ScrollTimeline
) but as soon as the finger is lifted it continues the animated effect by tracking time (via DocumentTimeline
). So in the first phase the animation needs to only be responsive to scroll offset changes and in seconds phase it needs to be responsive to both scroll offset and time. So in this case, if we had both timelines at the beginning then we would need to call animate function every frame even if there was no scrolling in that frame!
The explicit attach/detach idea help solve this issue. In particular, the animation will get all its needed timelines (primary, and those in options bag) during its construction. Then it can attach/detach to them as needed and its update rate is determined by its attached timelines.
So here is the proposal in more concrete terms:
- Attaching an animation to a timeline means that it will be updated if the timeline
currentTime
value changes WorkletAnimation
can explicitly attach itself to any timeline it has a reference to.- On initialization, a
WorkletAnimation
is attached to its primary timeline but not attached to other timeline that it received via its options bag. - The animation may still read the
currentTime
value of its detached timelines.
from animation-worklet.
A few bits of feedback:
- I feel a little bit uneasy about the primary timeline idea, because:
- Blessing one particular timeline feels a little odd. Is there somewhere else in the platform where we have this concept (so we can at least align terminology etc.)?
- It seems odd that you pass different classes of timelines using very different means (regular argument vs property bag).
- Can you change your primary timeline over time? e.g. if your hidey bar animation goes past the scroll threshold and becomes a timed animation, semantically it feels like your primary timeline has changed. If you can change the primary timeline, then using such different means to pass the different types of timelines seems all the more odd.
- I suspect we might find some good ideas in WPF and event .NET since they deal with hierarchies of timelines, I believe.
- The idea of attaching/detaching makes sense though. (We might call it listening?)
from animation-worklet.
This issue was moved to w3c/css-houdini-drafts#810
from animation-worklet.
Related Issues (20)
- Adapt to removal of AnimationEffectReadOnly from Web Animations
- Example doesn't meet idempotency requirement in Worklet spec. HOT 1
- partial interface AnimationEffect exposure set doesn't match original defintion HOT 5
- Add threading motivation details to introduction HOT 1
- Defaulting root to document is bad HOT 1
- Define AnimationWorklet as subset of Animation HOT 1
- README shouldn't talk about a "small subset" of properties HOT 1
- Allow constructing WorkletAnimation with single KeyframeEffect. HOT 3
- Define semantic of finish/reverse/playbackRate for Worklet Animation HOT 2
- s/it's/its/ HOT 2
- Improve potential for generating multiple animation frames in parallel HOT 11
- Allow animators to specify their desired frame rate HOT 3
- Data on performance impact of syncing state for stateful animators across threads HOT 2
- Scrollspy use case HOT 3
- `[Exposed=Worklet]` is too wide
- Running author function without proper preparation. HOT 4
- Attribute Delay, Iterations, Fill not working HOT 2
- Optional arguments in Web IDL must be trailing arguments HOT 1
- Move to CSS.animationWorklet
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from animation-worklet.