-
Notifications
You must be signed in to change notification settings - Fork 142
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
[css-animationworklet] Sending data to animators in worklet from main thread #869
Comments
An alternative approach is is support Using postMessage has a few advantages:
There are however several concern with using postMessage:
|
Thinking about this a bit more I believe we should limit this type of API to First it is not clear to me why a stateless animator needs to receive "options" given that its output should only be dependent on its More over it is not clear how this can be implemented properly for stateless animators where |
The Houdini Task Force just discussed
The full IRC log of that discussion<iank_> Topic: Sending data to animators in worklet from main thread (here since it is closely related to the above)<TabAtkins> github: https://github.com//issues/869 <iank_> majidvp: Similar issue as previous issue, we want to get some data from the main thread to the animation thread. We have this at startup with the options bag. <iank_> majidvp: The issue is that there might be new data on the main thread that affect the animation, e.g. sizes of elements change. <TabAtkins> q+ <iank_> majidvp: One idea is that do allow the options to be mutable, the main thread can up date the uptions, and it'll update the options on the animation thread. <iank_> majidvp: The other options is using a postmessage port with the animator. <iank_> flackr: If we want harmonize with css - we could do this with a property map. <iank_> TabAtkins: Yes . <iank_> flackr: There are several elements in play, and could read properties out of those elements. <iank_> TabAtkins: When the animate() function get called, are there element references? <iank_> majidvp: No the effect has a target, we don't expose that right now, but we could expose a styleMap. <iank_> TabAtkins: You'd want to limit the number of properties. <iank_> flackr: You could just expose all the same properties? <iank_> hober: I agree. <iank_> TabAtkins: Seems like we just want to expose inputProperties on the target for the effect? It doesn't let you pass information out however. <iank_> majidvp: There are usecases for more stateful effects, and this stage I'm fine with not solving this. <iank_> majidvp: These usecases are more important once you feed input events into animation worklet. But we don't have this yet, so its not pressing. <iank_> bkardell_: A message channel is good for JS, but not good for CSS? <flackr> iank_: another option is event dispatching <Rossen_> q? <TabAtkins> ack <TabAtkins> zakim, ack <Zakim> I don't understand 'ack', TabAtkins <TabAtkins> q- <Rossen_> ack TabAtkins <iank_> majidvp: Output could be events which fits nicely with the animations API. <iank_> majidvp: postmessage is more generic, but has its own lifetime concerns, but you might not want to commit to that. <iank_> TabAtkins: Add input properties, expose for the target, should work for input right now. And we'll pursue events / message channel later for output. <iank_> Proposal: Add input properties, expose for the target, should work for input right now. And we'll pursue events / message channel later for output. <iank_> RESOLVED: Add input properties, expose for the target, should work for input right now. And we'll pursue events / message channel later for output. <iank_> break 15 mins. <emilio> ScribeNick: emilio |
There's a difference between configurable animations and stateful animations. We set options for every keyframes animation but I wouldn't consider them stateful when they can be resolved for For instance, we might want to create a new tween/keyframes animation implementation that accepts references to easing functions not already available in the WebAnimations API that can't be described with a bezier curve (https://github.com/Popmotion/popmotion/blob/master/packages/easing/src/index.ts#L49) Options and state are different for this reason. |
I have a case where i have a I would have wished for something like So my 2nd effort will be to show a canvas behind the video element but that is not as much appealing as just adding a background to the video element instead. Therefore i need to 1) create a audio context Maybe someone have some tricks and tips for me of how i can solve this today? it would have been better to be able to add a video track cuz than i can show the video with picture in picture. currently the feature is disabled if there is no video tracks - hmm, don't know how to best solve it... i would wish for it to be possible to have some media buttons in the pip view - i know some work is being done to allow arbitrary content in pip so that you can have any html content you want inside of it. but not possible today |
Many useful effects running inside animation worklet may need to know about specific values from main thread, e.g., size of window or bounding client rects of various objects.
We allow such data to be sent when worklet animation (via
options
property) is being constructed. However this is limited since these values may change during the lifetime of the animation (e.g., window resize). Currently in these cases one has to cancel the current animation and create a new one. This does not work well and can cause jusmp if the animation has internal state.A simple logical extension is to allow options to be updated. Here is a proposal that achieves this:
In Animation Worklet context:
In document context:
Why method instead of a property?
This means we don't need to keep the options as a live object. This is similar to other Web-animation APIs.
The text was updated successfully, but these errors were encountered: