@@ -93,6 +93,10 @@ spec:css-color-4;
93
93
text:blue
94
94
text:transparent
95
95
spec:css-values-3; type:type; text:<time>
96
+ spec:web-animations-1;
97
+ type:dfn;
98
+ text: target properties
99
+ text: animation effect
96
100
</pre>
97
101
<!-- FIXME: These overrides aren't great for dev/TR switching -->
98
102
<pre class="anchors">
@@ -431,54 +435,12 @@ Starting of transitions {#starting}
431
435
</span>
432
436
</p>
433
437
434
- <p>
435
- Implementations must also maintain a set of
436
- <dfn export lt="completed transition">completed transitions</dfn> ,
437
- each of which
438
- (like <a>running transitions</a> )
439
- applies to a specific element and non-shorthand property.
440
- <span class="note">
441
- This specification maintains the invariant that
442
- there is never both a <a>running transition</a> and
443
- a <a>completed transition</a> for the same property and element.
444
- </span>
445
- </p>
446
-
447
438
<p>
448
439
If an element is no longer in the document,
449
440
implementations must <a>cancel</a> any <a>running transitions</a>
450
- on it and remove transitions on it from the
451
- <a>completed transitions</a> .
441
+ on that element.
452
442
</p>
453
443
454
- <div class="note">
455
-
456
- <p>
457
- This set of completed transitions
458
- needs to be maintained
459
- in order to prevent
460
- transitions from repeating themselves in certain cases,
461
- i.e., to maintain the invariant
462
- that this specification tries to maintain
463
- that unrelated style changes do not trigger transitions.
464
- </p>
465
-
466
- <p class="example">
467
- An example where maintaining the set of completed transitions
468
- is necessary would be a transition on
469
- an inherited property,
470
- where the parent specifies a transition of that property for
471
- a longer duration (say, ''transition: 4s text-indent'' )
472
- and a child element that inherits the parent's value specifies
473
- a transition of the same property for a shorter duration
474
- (say, ''transition: 1s text-indent'' ).
475
- Without the maintenance of this set of completed transitions,
476
- implementations could start additional transitions on the child
477
- after the initial 1 second transition on the child completes.
478
- </p>
479
-
480
- </div>
481
-
482
444
<p>
483
445
Various things can cause the <a>computed values</a> of properties
484
446
on an element to change.
@@ -538,29 +500,30 @@ Starting of transitions {#starting}
538
500
the previous style change event,
539
501
then transitions are not started for that element
540
502
in that style change event.
541
- Otherwise,
542
- define the <dfn export>before-change style</dfn> as
543
- the <a>computed values</a> of all properties on the element as of
544
- the previous <a>style change event</a> ,
545
- except with any styles derived from declarative
546
- animations such as CSS Transitions, CSS Animations
547
- ([[CSS3-ANIMATIONS]] ),
548
- and SMIL Animations ([[SMIL-ANIMATION]] , [[SVG11]] )
549
- updated to the current time.
550
- Likewise, define the <dfn export>after-change style</dfn> as
551
- the <a>computed values</a> of all properties
552
- on the element based on the information
553
- known at the start of that <a>style change event</a> ,
554
- but using the computed values of the 'animation-*' properties from the
555
- <a>before-change style</a> ,
556
- excluding any styles from CSS Transitions in the computation,
557
- and inheriting from
558
- the <a>after-change style</a> of the parent.
559
- Note that this means the <a>after-change style</a> does not differ from
560
- the <a>before-change style</a> due to newly created or canceled CSS
561
- Animations.
503
+ Otherwise, define the following:
562
504
</p>
563
505
506
+ <dl>
507
+ <dt> <dfn export>base style</dfn> </dt>
508
+ <dd>
509
+ the <a>computed values</a> of all properties on the element
510
+ as they <em> would be</em>
511
+ without any declarations from the "Animation" or "Transition" [[css-cascade-3#cascading-origins|origins]] ;
512
+ without any declarations originating from [[smil-animation|SMIL]] ;
513
+ and inheriting from the base style of the parent element.
514
+ </dd>
515
+
516
+ <dt> <dfn export>before-change style</dfn> </dt>
517
+ <dd>
518
+ the <a>base style</a> as of the previous <a>style change event</a> .
519
+ </dd>
520
+
521
+ <dt> <dfn export>after-change style</dfn> </dt>
522
+ <dd>
523
+ the <a>base style</a> as of the current <a>style change event</a> .
524
+ </dd>
525
+ </dl>
526
+
564
527
<div class="note">
565
528
<p>
566
529
Note that this definition of the <a>after-change style</a>
@@ -635,6 +598,11 @@ Starting of transitions {#starting}
635
598
''0px 0px black'' and ''inset 10px 10px black''
636
599
are <em> not</em> [=transitionable=] .
637
600
601
+ A property on a given element is <dfn>affected by an animation</dfn>
602
+ when there is a <a>relevant animation</a> for that element
603
+ whose <a>animation effect</a> is associated with that property
604
+ through its <a>target properties</a> .
605
+
638
606
For each element and property, the implementation must act
639
607
as follows:
640
608
@@ -646,17 +614,18 @@ Starting of transitions {#starting}
646
614
the element does not have
647
615
a <a>running transition</a> for the property,
648
616
</li>
617
+ <li>
618
+ the property is not <a>affected by an animation</a> ,
619
+ </li>
620
+ <li>
621
+ the property was not <a>affected by an animation</a>
622
+ at the time of the previous <a>style change event</a> ,
623
+ </li>
649
624
<li>
650
625
the <a>before-change style</a> is different from
651
626
the <a>after-change style</a> for that property,
652
627
and the values for the property are [=transitionable=] ,
653
628
</li>
654
- <li>
655
- the element does not have a <a>completed transition</a>
656
- for the property
657
- or the <a>end value</a> of the <a>completed transition</a>
658
- is different from the <a>after-change style</a> for the property,
659
- </li>
660
629
<li>
661
630
there is a <a>matching transition-property value</a> , and
662
631
</li>
@@ -665,8 +634,6 @@ Starting of transitions {#starting}
665
634
</li>
666
635
</ul>
667
636
then implementations must
668
- remove the <a>completed transition</a> (if present) from the set
669
- of completed transitions and
670
637
start a transition whose:
671
638
<ul>
672
639
<li>
@@ -698,23 +665,11 @@ Starting of transitions {#starting}
698
665
</ul>
699
666
</li>
700
667
<li>
701
- Otherwise,
702
- if the element has a <a>completed transition</a> for the property
703
- and the <a>end value</a> of the <a>completed transition</a>
704
- is different from the <a>after-change style</a> for the property,
705
- then implementations must
706
- remove the <a>completed transition</a> from the set of
707
- <a>completed transitions</a> .
708
- </li>
709
- <li>
710
- If the element has a <a>running transition</a> or
711
- <a>completed transition</a> for the property,
668
+ If the element has a <a>running transition</a> for the property,
712
669
and there is <strong> not</strong>
713
670
a <a>matching transition-property value</a> ,
714
671
then implementations must
715
- <a>cancel</a> the <a>running transition</a>
716
- or remove the <a>completed transition</a> from the set of
717
- <a>completed transitions</a> .
672
+ <a>cancel</a> the <a>running transition</a> .
718
673
</li>
719
674
<li>
720
675
If the element has a <a>running transition</a> for the property,
@@ -920,14 +875,35 @@ Starting of transitions {#starting}
920
875
property immediately changes to its final value).
921
876
</p>
922
877
923
- <p class="note">
924
- Note that above rules mean that
925
- transitions do not start when the computed
926
- value of a property changes as a result of declarative animation
927
- (as opposed to scripted animation).
928
- This happens because the before-change style includes up-to-date
929
- style for declarative animations.
930
- </p>
878
+ <div class="example" id="commitStyles-no-transition-start">
879
+ <pre>
880
+ <style>
881
+ #target {
882
+ transition: width 1s;
883
+ width: 100px;
884
+ }
885
+ </style>
886
+ <script>
887
+ let animation = target.animate([{ "width": "200px" }] , { duration: 1000 });
888
+ animation.finished.then(() => {
889
+ animation.commitStyles();
890
+ animation.cancel();
891
+ });
892
+ </script>
893
+ </pre>
894
+ <p>
895
+ The call to <code> commitStyles()</code>
896
+ will trigger a <a>style change event</a> ,
897
+ with the <a href="#before-change-style">before-change</a>
898
+ <code> width</code> being <code> 100px</code> ,
899
+ and the <a href="#after-change-style">after-change</a>
900
+ <code> width</code> being <code> 200px</code> .
901
+ However,
902
+ since <code> width</code> is <a>affected by an animation</a>
903
+ at the time of the previous <a>style change event</a> ,
904
+ no transition will start.
905
+ </p>
906
+ </div>
931
907
932
908
Faster reversing of interrupted transitions {#reversing}
933
909
--------------------------------------------------------
@@ -1059,15 +1035,14 @@ Completion of transitions {#complete}
1059
1035
but prior to the first <a>style change event</a>
1060
1036
whose time is equal to or after their <a>end time</a> .
1061
1037
When a transition completes,
1062
- implementations must move
1038
+ implementations must remove
1063
1039
all transitions that complete at that time
1064
1040
from the set of <a>running transitions</a>
1065
- to the set of <a>completed transitions</a>
1066
1041
and then fire the <a href="#transition-events">events</a>
1067
1042
for those completions.
1068
1043
<span class="note"> (Note that doing otherwise, that is,
1069
- firing some of the events before doing all of the moving
1070
- from <a>running transitions</a> to <a>completed transitions</a> ,
1044
+ firing some of the events before removing all completed transitions
1045
+ from <a>running transitions</a>
1071
1046
could allow
1072
1047
a style change event to happen
1073
1048
without the necessary transitions completing,
0 commit comments