-
Notifications
You must be signed in to change notification settings - Fork 142
[css-animationworklet] Separate Stateful and Stateless animator interfaces #812 #827
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
Conversation
stephenmcgruer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems reasonable to me. I am assuming you have already considered the benefits of having this inheritance approach versus, say, a static member variable or an argument to the WorkletAnimation constructor. (I think baking it into the worklet is probably better, I can't think of a reason for the same code to be reused for stateful and stateless).
css-animationworklet/Overview.bs
Outdated
|
|
||
| A user-defined stateful animator is expected to fulfill the required contract which is that its | ||
| state attribute is an object representing its state that can be serialized using structured | ||
| serialized algorithm and that it can also re-generatea its state given that same object passed to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: re-generate, but would actually suggest "recreate".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Using recreate.
css-animationworklet/Overview.bs
Outdated
| <pre class='lang-javascript'> | ||
| class BarAnimator extends StatefulAnimator { | ||
| constructor(options, state) { | ||
| // Called when a new animator is instantiated (either first time of after being respawned). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: 'first time or after'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
css-animationworklet/Overview.bs
Outdated
| An <dfn>Animator</dfn> represents an animation instance that is running on animation thread. Animators | ||
| are identified by a unique name and determine how the animation progresses its keyframe effects | ||
| given current input time. <a>Animator</a> instances live in {{AnimationWorkletGlobalScope}} and | ||
| each one is associated with a {{WorkletAnimation}} instance. An animator can only be instantiated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Just for my own clarification, I suppose a WorkletAnimation is the main thread instance?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is correct. I took a mental note to make this relationship more clear (perhaps even add a diagram).
css-animationworklet/Overview.bs
Outdated
|
|
||
| </div> | ||
|
|
||
| Note: If an animator state getter throws the user agent will remove the animator but does not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this normative text? If so, perhaps it shouldn't be a note?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was to make it clear that this is effectively the implication of the algorithm above. I remove the note to make it clear it is normative.
|
Thanks @birtles and @stephenmcgruer for feedback 👍 . I made corrections accordingly. |
Fixes issue #812 .
StatefulAnimatorandStatelessAnimator. Add sections to describe the difference.