Skip to content

Commit e971a0f

Browse files
authored
Remove usage of AnimationEffectReadonly and update WorkletGroupEffect (w3c#102)
Remove usage of AnimationEffectReadonly and update WorkletGroupEffect - Replace AnimationEffectReadonly with AnimationEffect since it no longer exist in upstream. - Update WorkletGroupEffect interface to match proposal here. Note that this removes dependency on web-animation level-2 spec since it conflicts with web-animation level-2. Minor clean ups: - use xml for idls instead of pre so we don't need to escape. See https://tabatkins.github.io/bikeshed/#xmp - Remove unused interface definitions Fixed w3c#101
1 parent c1e5a73 commit e971a0f

File tree

2 files changed

+835
-573
lines changed

2 files changed

+835
-573
lines changed

index.bs

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,6 @@ urlPrefix: https://w3c.github.io/web-animations/#; type: dfn;
5858
text: composite operation
5959
text: animation class
6060
urlPrefix: https://w3c.github.io/web-animations/level-2/#;
61-
type: interface;
62-
text: GroupEffectReadOnly
63-
text: AnimationEffectReadOnly
64-
text: AnimationEffectMutable
65-
text: GroupEffectMutable
66-
text: Animation
6761
type: dfn;
6862
text: group effect
6963
text: child effect
@@ -175,23 +169,23 @@ animations. The worklet can be accessed via {{animationWorklet}} attribute.
175169

176170
The {{animationWorklet}}'s <a>worklet global scope type</a> is {{AnimationWorkletGlobalScope}}.
177171

178-
{{AnimationWorkletGlobalScope}} represents a <dfn>global execution context</dfn> of
172+
{{AnimationWorkletGlobalScope}} represents the global execution context of
179173
{{animationWorklet}}.
180174

181-
<pre class='idl'>
175+
<xmp class='idl'>
182176
partial interface Window {
183177
[SameObject] readonly attribute Worklet animationWorklet;
184178
};
185-
</pre>
179+
</xmp>
186180

187-
<pre class='idl'>
181+
<xmp class='idl'>
188182
callback VoidFunction = void ();
189183

190184
[ Exposed=AnimationWorklet, Global=AnimationWorklet ]
191185
interface AnimationWorkletGlobalScope : WorkletGlobalScope {
192186
void registerAnimator(DOMString name, VoidFunction animatorCtor);
193187
};
194-
</pre>
188+
</xmp>
195189

196190

197191
<div class='note'>
@@ -504,18 +498,18 @@ animation's output.
504498
Creating a Worklet Animation {#creating-worklet-animation}
505499
-----------------------------------------------------------
506500

507-
<pre class='idl'>
501+
<xmp class='idl'>
508502

509503

510504
[Constructor (DOMString animatorName,
511-
optional (AnimationEffectReadOnly or sequence<AnimationEffectReadOnly>)? effects = null,
505+
optional (AnimationEffect or sequence<AnimationEffect>)? effects = null,
512506
optional AnimationTimeline? timeline,
513507
optional any options)]
514508
interface WorkletAnimation : Animation {
515509
readonly attribute DOMString animatorName;
516510
};
517511

518-
</pre>
512+
</xmp>
519513

520514

521515
<div algorithm="create-worklet-animation">
@@ -531,9 +525,9 @@ Creates a new {{WorkletAnimation}} object using the following procedure.
531525
{{Window}} that is the <a>current global object</a>.
532526

533527
3. Let |effect| be the result corresponding to the first matching condition from below.
534-
: If |effects| is a {{AnimationEffectReadOnly}} object,
528+
: If |effects| is a {{AnimationEffect}} object,
535529
:: Let effect be |effects|.
536-
: If |effects| is a <a>list</a> of {{AnimationEffectReadOnly}}</a> objects,
530+
: If |effects| is a <a>list</a> of {{AnimationEffect}}</a> objects,
537531
:: Let |effect| be a new {{WorkletGroupEffect}} with its children set to |effects|.
538532
: Otherwise,
539533
:: Let |effect| be undefined.
@@ -574,7 +568,7 @@ Here are a few implications of the above semantics:
574568
necessarily change its output, but may change the animation <a>play state</a>.
575569
- Similarly, invoking {{Animation/finish()}} or updating a <a>worklet animation's</a> <a>playback
576570
rate</a> will only change the animation <a>play state</a> and may not change the output.
577-
- Querying the animation effect's local time using {{AnimationEffectReadOnly/getComputedTiming()}}
571+
- Querying the animation effect's local time using {{AnimationEffect/getComputedTiming()}}
578572
may return stale information, in the case where the <a>animator instance</a> is running in a
579573
parallel execution context.
580574

@@ -682,20 +676,18 @@ corresponding <a>animator instance</a> can directly control the <a>child effects
682676
times</a>. This allows a single worklet animation to coordinate multiple effects - see
683677
[[#example-2]] for an example of such a use-case.
684678

685-
<pre class='idl'>
679+
<xmp class='idl'>
686680

687-
interface WorkletGroupEffectReadOnly : GroupEffectReadOnly {};
688-
689-
interface WorkletGroupEffect : WorkletGroupEffectReadOnly {};
690-
WorkletGroupEffect implements AnimationEffectMutable;
691-
WorkletGroupEffect implements GroupEffectMutable;
681+
interface WorkletGroupEffect {
682+
sequence<AnimationEffect> getChildren();
683+
};
692684

693685
[Exposed=AnimationWorklet]
694-
partial interface AnimationEffectReadOnly {
686+
partial interface AnimationEffect {
695687
// Intended for use inside Animation Worklet scope to drive the effect.
696688
attribute double localTime;
697689
};
698-
</pre>
690+
</xmp>
699691

700692
<div algorithm="set-local-time">
701693

@@ -713,9 +705,9 @@ action that corresponds to the first matching condition from the following:
713705

714706
</div>
715707

716-
Issue: The above algorithm should probably only apply to within the AnimationWorkletGlobalScope?
717-
718-
[Issue](https://github.com/w3c/web-animations/issues/191)
708+
Issue(w3c/csswg-drafts#2071): The above interface exposes a conservative subset
709+
of GroupEffect proposed as part of web-animation-2. Once that is available we
710+
should switch to it.
719711

720712

721713
Effect Stack and Composite Order {#effect-stack-composite-order}
@@ -837,7 +829,7 @@ const animation = new WorkletAnimation(
837829
new ScrollTimeline($scrollingContainer, {timeRange: 1000, startScrollOffset: 0, endScrollOffset: $header.clientHeight}));
838830
animation.play();
839831

840-
// Since this animation is using a group effect, the same animation instance
832+
// Since this animation is using a group effect, the same animation instance
841833
// is accessible via different handles: $avatarEl.getAnimations()[0], $headerEl.getAnimations()[0]
842834

843835
</script>

0 commit comments

Comments
 (0)