- From: Majid Valipour via GitHub <sysbot+gh@w3.org>
- Date: Wed, 29 Aug 2018 18:19:31 +0000
- To: public-houdini-archive@w3.org
I think we should go ahead an introduce a mode where the animator has to explicitly declare that it has` state` then by default effects are pure and engines can produce frame for them in parallel.
Here is some example API:
``` js
registerAnimator('my-statefull-effect', class {
// This ensures the engine produces frame in order.
// hasState is false by default which allows multiple frames to be produced in parallel and animator
// to be destroyed/migrated without needing to move state around worklet instances.
static hasState = true;
animate(currentTime, effects) {
const delta = currentTime - this.lastTime;
this.lastTime = currentTime;
this.acceleration += Math.random();
this.velocity += this.acceleration * delta;
effects[0].localTime = this.velocity * currentTime;
}
});
```
--
GitHub Notification of comment by majido
Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/812#issuecomment-417053881 using your GitHub account
Received on Wednesday, 29 August 2018 18:19:36 UTC