[css-animationworklet] Pure/idempotent representation
Nobody has claimed this yet.
- Dominant language
- Bikeshed
- Stars
- 1.9k
- Forks
- 149
- PR merge metrics
- No merged PRs in 30d
Description
From @appsforartists on September 27, 2016 18:50
The animators in the README use the class keyword and static properties to construct an animation worklet. For animators that remember state across frames (#4), this seems reasonable. However, many animators will be pure transformations of input to output. For both readability/stylistic purposes and to avoid needlessly allocating memory/CPU cycles, it may be desirable to have an alternate representation for pure animators.
Perhaps:
function animator(root, children, timeline) {
// compute frame
}
animator.inputProperties = ['--scroll-position'];
animator.outputProperties = ['opacity'];
or
const animator = {
inputProperties: [
'--scroll-position',
],
outputProperties: [
'opacity',
],
animate(root, children, timeline) {
// compute frame
},
}
NOTE: The present API is also mutative - output is expressed by settings properties on the input, not by returning values. Some authors will prefer a truly pure API, but that's more a matter of style than of minimizing resource usage.
Copied from original issue: WICG/animation-worklet#14
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the animator examples in the README and the stateful animator context in issue #4. Determine whether the project should specify an alternate pure representation and clarify its mutation or return-value semantics; done means the API direction is resolved and reflected in the relevant specification or documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100