@@ -39,7 +39,7 @@ urlPrefix: http://w3c.github.io/html/infrastructure.html#; type: dfn;
39
39
text: structureddeserialize
40
40
urlPrefix: https://www.w3.org/TR/css3-transitions/#; type: dfn;
41
41
text: animatable properties
42
- urlPrefix: https://w3c.github.io /web-animations/ #; type: dfn;
42
+ urlPrefix: https://drafts.csswg.org /web-animations#; type: dfn;
43
43
url: the-documents-default-timeline; text: default document timeline
44
44
url: concept-animation; text: animation
45
45
text: effect value
@@ -62,6 +62,11 @@ urlPrefix: https://w3c.github.io/web-animations/#; type: dfn;
62
62
text: running
63
63
text: composite operation
64
64
text: animation class
65
+ text: replace state
66
+ text: active
67
+ text: persisted
68
+ text: removed
69
+
65
70
urlPrefix: https://w3c.github.io/web-animations/level-2/#;
66
71
type: dfn;
67
72
text: group effect
@@ -338,8 +343,8 @@ and owns the instance specific state such as animation effect and timeline. It c
338
343
339
344
- An <dfn>animator effect</dfn> which is an <a>animation effect</a> .
340
345
341
- - An <dfn>animator current time</dfn> which is the corresponding <a>worklet animation</a> 's current
342
- time.
346
+ - An <dfn>animator current time</dfn> which is equivalent to its corresponding
347
+ <a>worklet animation</a> 's current time.
343
348
344
349
- An <dfn>animator timeline</dfn> which is a <a>timeline</a> .
345
350
@@ -518,9 +523,9 @@ either <dfn>frame-requested</dfn> or <dfn>frame-current</dfn>. It is initially s
518
523
<a>frame-current</a> . Different circumstances can cause the <a>animation requested flag</a> to be
519
524
set to <a>frame-requested</a> . These include the following:
520
525
- Changes in the <a>current time</a> of the animator's <a>timeline</a>
521
- - Changes in the <a>current time</a> of the animator's corresponding <a>Worklet Animation </a>
526
+ - Changes in the <a>current time</a> of the animator's corresponding <a>worklet animation </a>
522
527
523
- [[#running- animators]] resets the <a>animation requested flag</a> on animators to
528
+ Performing <a>run animators</a> resets the <a>animation requested flag</a> on animators to
524
529
<a>frame-current</a> .
525
530
526
531
@@ -531,8 +536,8 @@ Web Animations Integration {#web-animation-integration}
531
536
Worklet Animation {#worklet-animation-desc}
532
537
-------------------------------------------
533
538
<dfn>Worklet animation</dfn> is a kind of <a>animation</a> that delegates the animation playback to
534
- an <a>animator instance</a> . It controls the lifetime and playback state of its corresponding
535
- <a> animator instance</a> .
539
+ an <a>animator instance</a> . It controls the lifetime and playback state of its <a> corresponding
540
+ animator instance</a> .
536
541
537
542
Being an <a>animation</a> , <a>worklet animation</a> has an <a>animation effect</a> and a
538
543
<a>timeline</a> . However unlike other animations the worklet animation's <a>current time</a> does
@@ -543,14 +548,33 @@ animation's output.
543
548
544
549
<a>Worklet animation</a> has the following properties in addition to the {{Animation}} interface:
545
550
- an <dfn>animation animator name</dfn> which identifies its <a>animator definition</a> .
546
- - a <dfn>serialized options</dfn> which is serializable object that is used when
551
+ - a <dfn>serialized options</dfn> which is serializable options object that is used when
547
552
constructing a new animator instance.
553
+ - a <dfn>corresponding animator instance</dfn> which is an <a>Animator Instance</a> .
554
+
555
+
556
+ The existence of <a>corresponding animator instance</a> for a <a>worklet animation</a> depends on
557
+ the animation <a>play state</a> . See [[#web-animation-overrides]] for details on when and this
558
+ correspondence changes.
559
+
560
+ <xmp class='idl'>
561
+ [Exposed=Window,
562
+ Constructor (DOMString animatorName,
563
+ optional (AnimationEffect or sequence<AnimationEffect>)? effects = null,
564
+ optional AnimationTimeline? timeline,
565
+ optional any options)]
566
+ interface WorkletAnimation : Animation {
567
+ readonly attribute DOMString animatorName;
568
+ };
569
+
570
+ </xmp>
571
+
548
572
549
573
<figure>
550
574
<img src="img/WorkletAnimation-timing-model.svg" width="600"
551
575
alt="Overview of the WorkletAnimation timing model.">
552
576
<figcaption>
553
- Overview of the WorkletAnimation timing model. <br>
577
+ Overview of the worklet animation timing model. <br>
554
578
555
579
The animation current time is input to the animator instance, which produces a local time value
556
580
for the animation effect. If the animator instance is running in a parallel global scope the
@@ -564,23 +588,10 @@ animation's output.
564
588
Creating a Worklet Animation {#creating-worklet-animation}
565
589
-----------------------------------------------------------
566
590
567
- <xmp class='idl'>
568
- [Exposed=Window,
569
- Constructor (DOMString animatorName,
570
- optional (AnimationEffect or sequence<AnimationEffect>)? effects = null,
571
- optional AnimationTimeline? timeline,
572
- optional any options)]
573
- interface WorkletAnimation : Animation {
574
- readonly attribute DOMString animatorName;
575
- };
576
-
577
- </xmp>
578
-
579
-
580
591
<div algorithm="create-worklet-animation">
581
592
<dfn constructor for=WorkletAnimation>WorkletAnimation(|animatorName|, |effects|, |timeline|, |options|)</dfn>
582
593
583
- Creates a new {{WorkletAnimation}} object using the following procedure.
594
+ Creates a new {{WorkletAnimation}} object using the following procedure:
584
595
585
596
1. Let |workletAnimation| be a new {{WorkletAnimation}} object.
586
597
@@ -597,19 +608,22 @@ Creates a new {{WorkletAnimation}} object using the following procedure.
597
608
: Otherwise,
598
609
:: Let |effect| be undefined.
599
610
600
- 4. Run the procedure to <a>set the target effect of an animation</a> on |workletAnimation|
601
- passing |effect| as the new effect.
602
-
603
- 5. Let |serializedOptions| be the result of <a>StructuredSerialize</a> (|options|).
611
+ 4. Let |serializedOptions| be the result of <a>StructuredSerialize</a> (|options|).
604
612
Rethrow any exceptions.
605
613
606
- 6. Set the <a>serialized options</a> of |workletAnimation| to |serializedOptions|.
614
+ 5. Set the <a>serialized options</a> of |workletAnimation| to |serializedOptions|.
615
+
616
+ 6. Set the <a>animation animator name</a> of |workletAnimation| to |animatorName|.
617
+
618
+ 7. Run the procedure to <a>set the target effect of an animation</a> on |workletAnimation|
619
+ passing |effect| as the new effect. Note that this may trigger action to
620
+ <a>set animator instance of worklet animation</a> . See [[#web-animation-overrides]] for more
621
+ details.
607
622
608
- 7. Set the <a>animation animator name</a> of |workletAnimation| to |animatorName|.
609
623
</div>
610
624
611
625
612
- Worklet Animation timing model {#timing-model}
626
+ Worklet Animation Timing Model {#timing-model}
613
627
------------------------------------
614
628
615
629
This section describes how <a>worklet animation's</a> timing model differs from other
@@ -653,19 +667,44 @@ Issue(811): Come with appropriate mechanism's for <a>animator instance</a> to ge
653
667
it can react appropriately.
654
668
655
669
656
- Interaction with Animator Instances {#worklet -animation-animator-instances }
670
+ Web Animations Overrides {#web -animation-overrides }
657
671
-----------------------------------
658
672
659
- A <a>worklet animation</a> corresponds to at most one <a>animator instance</a> at any time, and may
660
- have no current corresponding <a>animator instance</a> . The correspondance of an <a>animator
661
- instance</a> for a <a>worklet animation</a> depends on the animation <a>play state</a> .
673
+ When a given worklet animation's <a>play state</a> changes from <a>idle</a> to <a>finished</a> ,
674
+ <a>running</a> , or <a>paused</a> , run the procedure to <a>associate animator instance of worklet
675
+ animation</a> given the worket animation as |workletAnimation|.
676
+
677
+ When a given worklet animation's <a>play state</a> changes from <a>finished</a> , <a>running</a> or
678
+ <a>paused</a> to <a>idle</a> , run the procedure to <a>disassociate animator
679
+ instance of worklet animation</a> given the worklet animation as |workletAnimation|.
680
+
681
+ When a given worklet animation's <a>replace state</a> changes from <a>active</a> to either
682
+ <a>persisted</a> or <a>removed</a> run the procedure to <a>disassociate animator
683
+ instance of worklet animation</a> given the worklet animation as |workletAnimation|.
684
+
685
+
686
+ Issue: In web-animation play state is updated before the actual change in particular some operations
687
+ such as play() are asynchronous. We should really invoke these Animator related operation after the
688
+ appropriate animation operation is complete instead of when play state has changed. This will
689
+ require either finding (or introducing) q new hook in web animation or having override for each such
690
+ async operation.
691
+
692
+
693
+ When the procedure to <a>set the target effect of an animation</a> for a given worklet animation
694
+ is called, then <a>set animator instance of worklet animation</a> given the worklet animation as
695
+ |workletAnimation|.
696
+
697
+ When the procedure to <a>set the timeline of an animation</a> for a given |workletAnimation|
698
+ is called, then <a>set animator instance of worklet animation</a> given the worklet animation as
699
+ |workletAnimation|.
700
+
662
701
663
702
<div algorithm="associate-animator-instance">
664
703
665
704
To <dfn>associate animator instance of worklet animation</dfn> given |workletAnimation|,
666
705
the user agent <em> must</em> run the following steps:
667
706
668
- 1. If |workletAnimation| has a corresponding <a>animator instance</a> , abort the following steps.
707
+ 1. If |workletAnimation| has a <a>corresponding animator instance</a> , abort the following steps.
669
708
2. Let |workletGlobalScope| be the {{AnimationWorkletGlobalScope}} associated with
670
709
|workletAnimation|.
671
710
3. <a>Queue a task</a> on |workletGlobalScope| to run the procedure to <a>create a new animator
@@ -675,8 +714,8 @@ the user agent <em>must</em> run the following steps:
675
714
* The |workletAnimation|'s <a>animation effect</a> as effect.
676
715
* The |workletAnimation|'s <a>serialized options</a> as options.
677
716
* The |workletGlobalScope| as workletGlobalScope.
678
- 4. If the procedure was successful, set the resulting <a>animator instance</a> as corresponding to
679
- |workletAnimation|.
717
+ 4. If the procedure was successful, set the resulting <a>animator instance</a> to be the
718
+ <a>corresponding animator instance</a> of |workletAnimation|.
680
719
681
720
</div>
682
721
@@ -685,19 +724,18 @@ the user agent <em>must</em> run the following steps:
685
724
To <dfn>disassociate animator instance of worklet animation</dfn> given
686
725
|workletAnimation|, the user age <em> must</em> run the following steps:
687
726
688
- 1. If |workletAnimation| does not have a corresponding <a>animator instance</a> , abort the
727
+ 1. If |workletAnimation| does not have a <a>corresponding animator instance</a> , abort the
689
728
following steps.
690
729
2. Let |workletGlobalScope| be the {{AnimationWorkletGlobalScope}} associated with
691
730
|workletAnimation|.
692
- 3. Let |animatorInstance| be |workletAnimation|'s corresponding <a>animator instance</a> .
731
+ 3. Let |animatorInstance| be |workletAnimation|'s <a>corresponding animator instance</a> .
693
732
4. <a>Queue a task</a> on the |workletGlobalScope| to run the procedure to <a>remove an animator
694
733
instance</a> , passing |animatorInstance| as instance and |workletGlobalScope| as
695
734
workletGlobalScope.
696
- 5. Set |workletAnimation| as having no corresponding <a>animator instance</a> .
735
+ 5. Set |workletAnimation|'s <a>corresponding animator instance</a> as undefined .
697
736
698
737
</div>
699
738
700
-
701
739
<div algorithm="set-animator-instance">
702
740
703
741
To <dfn>set animator instance of worklet animation</dfn> given
@@ -708,21 +746,6 @@ To <dfn>set animator instance of worklet animation</dfn> given
708
746
709
747
</div>
710
748
711
- When a given |workletAnimation|'s <a>play state</a> changes to <a>pending</a> , <a>running</a> , or
712
- <a>paused</a> , run the procedure to
713
- <a>associate animator instance of worklet animation</a> given |workletAnimation|.
714
-
715
-
716
- When a given |workletAnimation|'s <a>play state</a> changes to <a>idle</a> or <a>finished</a> ,
717
- run the procedure to
718
- <a>disassociate animator instance of worklet animation</a> given |workletAnimation|.
719
-
720
- When the procedure to <a>set the target effect of an animation</a> for a given |workletAnimation|
721
- is called, then <a>set animator instance of worklet animation</a> given |workletAnimation|.
722
-
723
- When the procedure to <a>set the timeline of an animation</a> for a given |workletAnimation|
724
- is called, then <a>set animator instance of worklet animation</a> given |workletAnimation|.
725
-
726
749
727
750
728
751
ScrollTimeline {#scroll-timeline}
@@ -746,8 +769,8 @@ WorkletGroupEffect {#worklet-group-effect}
746
769
{{WorkletGroupEffect}} is a type of <a>group effect</a> that allows its <a>child effect's</a>
747
770
<a>local times</a> to be mutated individually.
748
771
749
- When a {{WorkletGroupEffect}} is set as the <a>animation effect</a> of a {{WorkletAnimation}} , the
750
- corresponding <a>animator instance</a> can directly control the <a>child effects</a> ' <a>local
772
+ When a {{WorkletGroupEffect}} is set as the <a>animation effect</a> of a <a>worklet animation</a> ,
773
+ its <a>corresponding animator instance</a> can directly control the <a>child effects</a> ' <a>local
751
774
times</a> . This allows a single worklet animation to coordinate multiple effects - see
752
775
[[#example-2]] for an example of such a use-case.
753
776
0 commit comments