Re: [css-houdini-drafts] [css-animationworklet] Listening events in animation worklet (#834)

## On transferring data from main thread

I think this the need such a mechanism to make animation worklet useful. Since 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.

Since we already allow data to be sent when worklet animation (via `options`) when it is constructed. The logical extension is to allow options to be updated as well. This is a simple and reasonable extension. I will update the spec to allow this.

See  more details on specific proposed change here: https://bugs.chromium.org/p/chromium/issues/detail?id=932619


## On listening to events in animation worklet

Again I think there is a lot of merit to this idea. In fact, one of [our goals](https://github.com/w3c/css-houdini-drafts/blob/master/css-animationworklet/principles.md#third-principle---interactivity) is to allow worklet animation inside animation worklet context to be able to react to user input (touch, gesture, etc.)

We have been trying to come up with the right abstraction and API to allow this (see: [1](https://docs.google.com/document/d/1-APjTs9fn4-E7pFeFSfiWV8tYitO84VpmKuNpE-25Qk/edit), [2](https://github.com/w3c/csswg-drafts/issues/2493), [3](https://github.com/w3c/csswg-drafts/issues/2493#issuecomment-422109535)), and our recent idea which I am very hopeful about is captured [here](https://docs.google.com/document/d/1byDy6IZqvaci-FQoiRzkeAmTSVCyMF5UuaSeGJRHpJk/edit#heading=h.dc7o68szgx2r). 


I think once we have the solution for sending data from main thread to worklet, one can build a simple event forwarding on top of it. But we need a better solution to have low-latency event forwarding which the other ideas are trying to address.

-- 
GitHub Notification of comment by majido
Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/834#issuecomment-470579488 using your GitHub account

Received on Thursday, 7 March 2019 15:49:44 UTC