Skip to content

Commit 4495ac6

Browse files
committed
[scroll-animations] Move animation-timeline to css-animations-2 (#5159)
1 parent 6cdb364 commit 4495ac6

File tree

3 files changed

+78
-94
lines changed

3 files changed

+78
-94
lines changed

css-animations-2/Overview.bs

+73
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,12 @@ urlPrefix: https://drafts.csswg.org/web-animations-1/; type: dfn; spec: web-anim
6464
text: target element
6565
text: target effect
6666
text: target effect end
67+
text: timeline
6768
text: unresolved
69+
text: default document timeline
6870
urlPrefix: https://drafts.csswg.org/css-writing-modes-4/; type: dfn; spec: css-writing-modes-4
6971
text: equivalent physical property; url: logical-to-physical
72+
urlPrefix: https://drafts.csswg.org/css-values-4/; spec:css-values-4; type:dfn; text:css identifier
7073
</pre>
7174

7275
<h2 id="delta">Delta specification</h2>
@@ -516,6 +519,76 @@ keyframe specifying each property.
516519
Issue: Create pictures of these examples and verify they make sense.
517520
</div>
518521
522+
523+
## The 'animation-timeline' property ## {#animation-timeline}
524+
525+
The 'animation-timeline' property defines the <a>timeline</a> used with the
526+
animation.
527+
528+
Note: This specification does not introduce any syntax to specify animation
529+
timelines but instead it is up to others specifications such as Scroll-linked
530+
Animations [[SCROLL-ANIMATIONS]] to do so.
531+
532+
<pre class='propdef'>
533+
Name: animation-timeline
534+
Value: <<single-animation-timeline>>#
535+
Initial: auto
536+
Applies to: all elements
537+
Inherited: no
538+
Percentages: N/A
539+
Computed value: list, each item either a case-sensitive [=css identifier=] or
540+
the keywords ''single-animation-timeline/none'',
541+
''single-animation-timeline/auto''.
542+
Canonical order: per grammar
543+
Animatable: no
544+
</pre>
545+
546+
<pre>
547+
<dfn>&lt;single-animation-timeline></dfn> = auto | none | <<timeline-name>>
548+
</pre>
549+
550+
The 'animation-timeline' property is similar to properties like 'animation-name'
551+
and 'animation-duration' in that it can have one or more values, each one
552+
imparting additional behavior to a corresponding [=animation=] on the element,
553+
with the timelines matched up with animations as described
554+
[[css-animations-1#animation-name|here]].
555+
556+
Each value has type <<single-animation-timeline>>, whose possible values have
557+
the following effects:
558+
559+
: <dfn for="single-animation-timeline" dfn-type=value>auto</dfn>
560+
:: The animation's [=timeline=] is a {{DocumentTimeline}}, more specifically
561+
the <a>default document timeline</a>.
562+
563+
: <dfn for="single-animation-timeline" dfn-type=value>none</dfn>
564+
:: The animation is not associated with a [=timeline=].
565+
566+
: <dfn>&lt;timeline-name></dfn>
567+
:: Find the last timeline at-rule in document order with its name matching
568+
<<timeline-name>>. If such a timeline at-rule exists, then the animation's
569+
[=timeline=] is a timeline as defined by that rule. Otherwise the animation
570+
is not associated with a [=timeline=].
571+
<pre>
572+
&lt;timeline-name> = <<custom-ident>> | <<string>>
573+
</pre>
574+
575+
576+
Issue: Make it easier to use 'animation-name' to select the timeline when
577+
'animation-timeline' is not specified. Allowing 'animation-name' to be used for
578+
selecting timeline enables most common animations to have to use a single name
579+
for both their keyframes and timeline which is simple and ergonomics. The
580+
'animation-timeline' property gives authors additional control to independently
581+
select keyframes and timeline if necessary.
582+
583+
584+
## The 'animation' shorthand property ## {#animation-shorthand}
585+
586+
The 'animation' shorthand property syntax is as follows:
587+
588+
<dfn>&lt;single-animation></dfn> = <<time>> || <<easing-function>> || <<time>> || <<single-animation-iteration-count>> || <<single-animation-direction>> || <<single-animation-fill-mode>> || <<single-animation-play-state>> || [ none | <<keyframes-name>> ] || <<single-animation-timeline>>
589+
590+
591+
519592
# Animation Events # {#events}
520593
521594
## Event dispatch ## {#event-dispatch}

scroll-animations-1/Overview.bs

+2-91
Original file line numberDiff line numberDiff line change
@@ -683,94 +683,6 @@ offset=] and its [=effective end offset=] to be non-null. This means that for
683683
example if one uses an element-based offset whose {{target}} is not a descendant
684684
of the scroll timeline {{source}}, the timeline remains inactive.
685685

686-
## The 'animation-timeline' property ## {#animation-timeline}
687-
688-
A {{ScrollTimeline}} may be applied to a CSS Animation [[CSS3-ANIMATIONS]] using
689-
either the 'animation-timeline' property or 'animation-name' property. With the
690-
former taking precedent over the latter.
691-
692-
<pre class='propdef'>
693-
Name: animation-timeline
694-
Value: <<single-animation-timeline>>#
695-
Initial: auto
696-
Applies to: all elements, ::before and ::after pseudo-elements
697-
Inherited: no
698-
Animatable: no
699-
Percentages: N/A
700-
Media: interactive
701-
Computed value: As specified
702-
Canonical order: per grammar
703-
</pre>
704-
705-
<pre>
706-
<dfn>&lt;single-animation-timeline></dfn> = auto | none | <<timeline-name>>
707-
</pre>
708-
709-
The 'animation-timeline' property is similar to properties like
710-
'animation-name' and 'animation-duration' in that it can have one or
711-
more values, each one imparting additional behavior to a corresponding
712-
[=animation=] on the element, with the timelines matched up with animations as
713-
described [[css-animations-1#animation-name|here]].
714-
715-
Each value has type <<single-animation-timeline>>, whose possible values have
716-
the following effects:
717-
718-
: auto
719-
:: The animation's [=timeline=] is a {{DocumentTimeline}}, more specifically
720-
the <a>default document timeline</a>.
721-
722-
: none
723-
:: The animation is not associated with a [=timeline=].
724-
725-
726-
: <<timeline-name>>
727-
:: If ''@scroll-timeline'' rule with the name specified by <<timeline-name>>, then
728-
the animation's [=timeline=] is a timeline whose property values are
729-
provided by that rule. Otherwise there is no [=timeline=] associated with
730-
the animation.
731-
732-
733-
If 'animation-timeline' property is not specified but 'animation-name' is
734-
specified then its value is used to select the scroll-timeline at-rule that
735-
provides the property values for the animation's timeline.
736-
737-
Note: Allowing animation-name to be used for selecting timeline enables most
738-
common animations to have to use a single name for both their keyframes and
739-
timeline which is simple and ergonomics. The 'animation-timeline' property gives
740-
additional control to authors to independently select keyframes and timeline if
741-
necessary.
742-
743-
744-
In this case, each possible value of type <<keyframes-name>> from
745-
'animation-name' has the following effects:
746-
747-
: none
748-
:: No timelines and keyframes are specified at all, so there will be no
749-
animation. Any other animations properties specified for this animation have no
750-
effect.
751-
752-
753-
: <<keyframes-name>>
754-
:: If ''@scroll-timeline'' rule with the name specified by <<keyframes-name>>, then
755-
the animation's [=timeline=] is a timeline whose property values are
756-
provided by that rule. Otherwise the animation's [=timeline=] is a
757-
{{DocumentTimeline}}, more specifically the <a>default document
758-
timeline</a>.
759-
760-
Note: Notice that the behavior for the case where no timeline with the given
761-
name is found is different for these two properties. This ensures backward
762-
compatibility because all existing time-based animations with 'animation-name'
763-
specified expect to use <a>default document timeline</a>.
764-
765-
### Changes to the 'animation' shorthand property ### {#animation-shorthand}
766-
767-
The 'animation' shorthand property syntax is updated to accept an additional
768-
optional <<timeline-name>>.
769-
770-
<dfn>&lt;single-animation></dfn> = <<time>> || <<easing-function>> || <<time>> || <<single-animation-iteration-count>> || <<single-animation-direction>> || <<single-animation-fill-mode>> || <<single-animation-play-state>> || [ none | <<keyframes-name>> ] || [ none | <<timeline-name>> ]
771-
772-
Issue: Update css-animations spec instead of monkey-patching it here.
773-
774686
## The '@scroll-timeline' at-rule ## {#scroll-timeline-at-rule}
775687

776688
[=Scroll Timelines=] are specified in CSS using the <dfn>@scroll-timeline</dfn>
@@ -779,18 +691,17 @@ at-rule, defined as follows:
779691
<pre>
780692
@scroll-timeline = @scroll-timeline <<timeline-name>> { <<declaration-list>> }
781693

782-
783-
<dfn>&lt;timeline-name></dfn> = <<custom-ident>> | <<string>>
784694
</pre>
785695

786-
787696
An ''@scroll-timeline'' rule has a name given by the <<custom-ident>> or <<string>> in
788697
its prelude. The two syntaxes are equivalent in functionality; the name is the
789698
value of the ident or string. As normal for <<custom-ident>>s and <<string>>s,
790699
the names are fully case-sensitive; two names are equal only if they are
791700
codepoint-by-codepoint equal. The <<custom-ident>> additionally excludes the
792701
none keyword.
793702

703+
Once specified, a scroll timeline may be associated with a CSS Animation
704+
[[CSS3-ANIMATIONS]] by using the 'animation-timeline' property.
794705

795706
The <<declaration-list>> inside of ''@scroll-timeline'' rule can only contain the
796707
descriptors defined in this section.

web-animations-1/Overview.bs

+3-3
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ a timing node is not in a state to produce a <a>time value</a>.
615615
Timelines {#timelines}
616616
----------------------------------------
617617

618-
A <dfn>timeline</dfn> provides a source of <a>time values</a> for the
618+
A <dfn export>timeline</dfn> provides a source of <a>time values</a> for the
619619
purpose of synchronization.
620620

621621
At any given moment, a [=timeline=] has a single current [=time value=] known
@@ -755,8 +755,8 @@ time=]. If |timeline| is inactive, return an [=unresolved=] [=time value=].
755755

756756
### The default document timeline ### {#the-documents-default-timeline}
757757

758-
Each {{Document}} has a <a>document timeline</a> called the <dfn>default
759-
document timeline</dfn>.
758+
Each {{Document}} has a <a>document timeline</a> called the
759+
<dfn export>default document timeline</dfn>.
760760
The <a>default document timeline</a> is unique to each document and persists for
761761
the lifetime of the document including calls to <a>document.open()</a> [[!HTML]].
762762

0 commit comments

Comments
 (0)