Skip to content
121 changes: 116 additions & 5 deletions scroll-animations-1/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -353,18 +353,99 @@ spec: cssom-view-1; type: dfn;

Values are as defined for ''scroll()''.

The [=used value=] of 'scroll-timeline-axis'
is the axis of the timeline's [=attachment=],
or the initial value if there is no [=attachment=].

### Attachment of a Scroll Progress Timeline: the 'scroll-timeline-attachment' property ### {#scroll-timeline-attachment}

<pre class='propdef'>
Name: scroll-timeline-attachment
Value: [ local | defer | ancestor ]#
Initial: local
Applies to: all elements
Inherited: no
Computed value: a list of the keywords specified
Animation type: not animatable
</pre>

Specifies attachment behavior for each [=scroll progress timeline=]
associated with this element.

A scroll timeline has an <dfn>attachment</dfn>,
that determines which [=scroll container=] and {{ScrollTimeline/axis}} to use
when calculating the [progress of the timeline](#scroll-timeline-progress).

<dl>
<dt><dfn>'local'</dfn>
<dd>
The [=attachment=] is this timeline.

<dt><dfn>'defer'</dfn>
<dd>
The [=attachment=] is the timeline among the flat-tree descendants
that satisfies all of the following:
- The timeline has a matching 'scroll-timeline-name'.
- The timeline has [=ancestor=] attachment.
- The timeline has no intermediate [=defer|deferred=] timeline
that would capture it.

If more than one such candidate exists,
then this timeline has no [=attachment=].

<dt><dfn>'ancestor'</dfn>
<dd>
The timeline has no [=attachment=].

Timelines with [=ancestor=] attachment are treated as nameless
for the purposes of timeline lookup;
they can't be referenced by 'animation-timeline'.
</dl>

Timelines that have no [=attachment=] are [=inactive timeline|inactive=].

<div class=example>
Using a [=defer|deferred timeline=],
an element can effectively refer to timelines
that appear <em>after it</em> in tree order.
For example, the following creates an animation on <code>#target</code> that
is ultimately linked to a scroll timeline defined on the subsequent sibling.

<pre class=lang-css>
@keyframes anim {
from { color: red; }
to { color: green; }
}

#root {
scroll-timeline-name: mytimeline;
scroll-timeline-attachment: defer;
}

#root #target {
animation: anim auto;
animation-timeline: mytimeline;
}

#root #target + #scroller {
scroll-timeline-name: mytimeline;
scroll-timeline-attachment: ancestor;
}
</pre>
</div>

### Scroll Timeline Shorthand: the 'scroll-timeline' shorthand ### {#scroll-timeline-shorthand}

<pre class='propdef shorthand'>
Name: scroll-timeline
Value: [ <<'scroll-timeline-name'>> <<'scroll-timeline-axis'>>? ]#
Value: [ <<'scroll-timeline-name'>> [ <<'scroll-timeline-axis'>> || <<'scroll-timeline-attachment'>> ]? ]#
Applies to: [=scroll containers=]
Inherited: no
Animation type: not animatable
</pre>

This property is a [=shorthand=] for setting
'scroll-timeline-name' and 'scroll-timeline-axis'
'scroll-timeline-name', 'scroll-timeline-axis', and 'scroll-timeline-attachment'
in a single declaration.

# View Progress Timelines # {#view-timelines}
Expand Down Expand Up @@ -662,6 +743,10 @@ spec: cssom-view-1; type: dfn;
Specifies an axis for each named [=view progress timeline=]
associated with this [=scroll container=].

The [=used value=] of 'view-timeline-axis'
is the axis of the timeline's [=attachment=],
or the initial value if there is no [=attachment=].

### Inset of a View Progress Timeline: the 'view-timeline-inset' property ### {#view-timeline-inset}

<pre class='propdef'>
Expand Down Expand Up @@ -695,16 +780,42 @@ spec: cssom-view-1; type: dfn;
defines an inward offset from the corresponding edge of the scrollport.
</dl>

The [=used value=] of 'view-timeline-inset'
is the inset of the timeline's [=attachment=],
or the initial value if there is no [=attachment=].

### Attachment of a View Progress Timeline: the 'view-timeline-attachment' property ### {#view-timeline-attachment}

<pre class='propdef'>
Name: view-timeline-attachment
Value: [ local | defer | ancestor ]#
Initial: local
Applies to: all elements
Inherited: no
Computed value: a list of the keywords specified
Animation type: not animatable
</pre>

Specifies attachment behavior for each [=view progress timeline=]
associated with this element.

The behavior of 'view-timeline-attachment'
is similar to that of 'scroll-timeline-attachment',
except that the [=attachment=] of a view timeline also determines
the <a property lt="view-timeline-inset">inset</a>
and {{ViewTimeline/subject}} to use
when calculating the [progress of the timeline](#view-timeline-progress).

### View Timeline Shorthand: the 'view-timeline' shorthand ### {#view-timeline-shorthand}

<pre class='propdef shorthand'>
Name: view-timeline
Value: [ <<'view-timeline-name'>> <<'view-timeline-axis'>>? ]#
Value: [ <<'view-timeline-name'>> [ <<'view-timeline-axis'>> || <<'view-timeline-attachment'>> ]? ]#
Applies to: all elements
</pre>

This property is a [=shorthand=] for setting
'view-timeline-name' and 'view-timeline-axis'
'view-timeline-name', 'view-timeline-axis', and 'view-timeline-attachment'
in a single declaration.
It does not set 'view-timeline-inset'.

Expand Down Expand Up @@ -776,7 +887,7 @@ spec: cssom-view-1; type: dfn;
In case of a name conflict on the same element,
[=scroll progress timelines=] take precedence over [=view progress timelines=].

ISSUE(7759): We plan to add functionality to expand the scope.
Note: [=defer|Deferred timelines=] effectively allow scoping beyond this.

## Animation Events ## {#events}

Expand Down