Skip to content
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] Listening to events in Animation Worklet #834

Open
RDMStreet opened this issue Nov 22, 2018 · 3 comments
Open

[css-animationworklet] Listening to events in Animation Worklet #834

RDMStreet opened this issue Nov 22, 2018 · 3 comments

Comments

@RDMStreet
Copy link

@RDMStreet RDMStreet commented Nov 22, 2018

Can I listen events in animation worklet or transfer data from main thread to running animation worklet?

@majido
Copy link
Contributor

@majido majido commented Mar 7, 2019

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

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 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, 2, 3), and our recent idea which I am very hopeful about is captured here.

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.

@majido
Copy link
Contributor

@majido majido commented Mar 27, 2019

I filed a separate issue for sending data from main to worklet since I believe the usecases and APIs differ. Lets keep this issue focused on receiving events inside worklet.

@majido majido changed the title [css-animationworklet] Listening events in animation worklet [css-animationworklet] Listening to events in Animation Worklet Mar 27, 2019
majido added a commit that referenced this issue May 21, 2019
Drop multiple timelines and relevant concepts for Animation Worklet.

This also drops the hide-bar example from spec. I may re-work this example (e.g., switching timeline via setting animation.timeline on main thread) and add it back this in future but for now dropping it is simpler.

Multiple timeline was originally the solution that would allow seamless switching between between
scroll timeline and regular timelines. Since then we have iterated over multiple different solutions.

See #834  for a list of various design we have considered. It seems that allowing events to be handled
in Animation Worklets will enable the relevant usecases.

For now we drop multiple timelines fromAnimation Worklet Level-1 to ensure simplicity and better alignment with WebAnimations.
@majido
Copy link
Contributor

@majido majido commented Jun 25, 2019

The proposal for allowing input events to worklets is now published under WICG: https://discourse.wicg.io/t/proposal-exposing-input-events-to-worker-threads/3479

Here is the explainer for it. I am working closely with other folks on this to make sure it addresses Animation Worklet usecases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants