@@ -115,10 +115,10 @@ spec: cssom-view-1; type: dfn;
115115
116116 [=Scroll progress timelines=] can be referenced in 'animation-timeline'
117117 anonymously using the ''scroll()'' [=functional notation=]
118- or by naming them using the 'scroll- timeline' properties
119- and referring to them by name .
118+ or by name (see [[# timeline-scope]] )
119+ after declaring them using the 'scroll-timeline' properties .
120120 In the Web Animations API,
121- can be represented by the {{ScrollTimeline}} interfaces .
121+ they can be represented anonymously by a {{ScrollTimeline}} object .
122122
123123## Anonymous Scroll Progress Timelines ## {#scroll-timelines-anonymous}
124124
@@ -197,10 +197,12 @@ spec: cssom-view-1; type: dfn;
197197 constructor(optional ScrollTimelineOptions options = {});
198198 readonly attribute Element? source;
199199 readonly attribute ScrollDirection axis;
200+ readonly attribute double startTime;
201+ readonly attribute double endTime;
200202 };
201203 </pre>
202204
203- A <dfn> {{ScrollTimeline}}</dfn> is an {{AnimationTimeline}}
205+ A {{ScrollTimeline}} is an {{AnimationTimeline}}
204206 that specifies a [=scroll progress timeline=] .
205207 It can be passed to
206208 the {{Animation}} constructor or the {{Animatable/animate()}} method
@@ -215,6 +217,18 @@ spec: cssom-view-1; type: dfn;
215217 :: Specifies the axis of scrolling
216218 that drives the progress of the timeline.
217219 See <<axis>> , above.
220+
221+ : <dfn>startTime</dfn>
222+ :: Represents the [=scroll container=] ’s startmost (reachable) scroll position
223+ as its scroll offset in ''px''
224+ when the timeline is [=timeline active phase|active=] .
225+ Null when it is [=timeline inactive phase|inactive=] .
226+
227+ : <dfn>endTime</dfn>
228+ :: Represents the [=scroll container=] ’s endmost (reachable) scroll position
229+ as its scroll offset in ''px''
230+ when the timeline is [=timeline active phase|active=] .
231+ Null when it is [=timeline inactive phase|inactive=] .
218232 </dl>
219233
220234 <dl class="constructors">
@@ -239,16 +253,39 @@ spec: cssom-view-1; type: dfn;
239253 to the corresponding value from |options|.
240254 </dl>
241255
256+ Inherited attributes:
257+ <dl>
258+ : {{AnimationTimeline/currentTime}} (inherited from {{AnimationTimeline}}
259+ :: Represents the scroll progress of the [=scroll container=]
260+ as its scroll offset in ''px''
261+ when the timeline is [=timeline active phase|active=] .
262+ Null when it is [=timeline inactive phase|inactive=] .
263+ </dl>
264+
242265 If the {{ScrollTimeline/source}} of a {{ScrollTimeline}}
243266 is an element whose [=principal box=] does not exist
244267 or is not a [=scroll container=] ,
245268 then the {{AnimationTimeline/phase}} is the [=timeline inactive phase=] .
246269 It is otherwise in the [=timeline active phase|active=] phase.
247270
248- The {{AnimationTimeline/currentTime}} of a {{ScrollTimeline}}
249- represents the scroll progress of the [=scroll container=] .
250- It is <span class="issue"> ????</span> when the timeline is [=timeline active phase|active=]
251- and null when it is [=timeline inactive phase|inactive=] .
271+ Note: The {{ScrollTimeline/startTime}} and {{ScrollTimeline/endTime}} attributes
272+ have odd names for being specific to ScrollTimeline;
273+ this is to keep them consistent with {{AnimationTimeline/currentTime}} ,
274+ which represents the currently-active position on the same scale.
275+
276+ Percentage progress along the [=scroll progress timeline=]
277+ is calculated as
278+ ({{AnimationTimeline/currentTime}} − {{ScrollTimeline/startTime}} )
279+ ÷
280+ ({{ScrollTimeline/startTime}} - {{ScrollTimeline/endTime}} ).
281+
282+ ISSUE: Should there be a convenience function to get this info?
283+
284+ ISSUE: Review effect of [=writing modes=] and [=box alignment properties=]
285+ and make sure we're getting what we want here.
286+ Afaict, 0% will represent the initial scroll position
287+ unless alignment changes it to initialize at a different scroll position,
288+ in which case 0% will be the startmost, but not the initial, scroll position.
252289
253290 A {{ScrollTimeline}} ’s {{EffectTiming/duration}} is 100%.
254291
@@ -312,7 +349,9 @@ spec: cssom-view-1; type: dfn;
312349
313350 Often animations are desired to start and end
314351 during the portion of the [=scroll progress timeline=]
315- that a particular element is in view within the [=scrollport=] .
352+ that a particular element
353+ (the <dfn>view progress subject</dfn> element)
354+ is in view within the [=scrollport=] .
316355 <dfn export>View progress timelines</dfn>
317356 are segments of a [=scroll progress timeline=]
318357 that are scoped to the scroll positions
@@ -322,10 +361,102 @@ spec: cssom-view-1; type: dfn;
322361 and the endmost such scroll position represents 100% progress.
323362
324363 [=View progress timelines=] can be referenced in 'animation-timeline' by name
325- after declaring them using the 'view-timeline' properties.
364+ (see [[#timeline-scope]] )
365+ after declaring them using the 'view-timeline' properties
366+ on the view progress subject.
367+ In the Web Animations API,
368+ they can be represented anonymously by a {{ViewTimeline}} object.
369+
370+ ## Anonymous View Progress Timelines ## {#view-timelines-anonymous}
371+
372+ ### The {{ViewTimeline}} Interface ### {#viewtimeline-interface}
373+
374+ <pre class="idl">
375+ dictionary ViewTimelineOptions {
376+ Element source;
377+ ScrollDirection axis = "block";
378+
379+ };
380+
381+ [Exposed=Window]
382+ interface ViewTimeline : ScrollTimeline {
383+ constructor(optional ViewTimelineOptions options = {});
384+ readonly attribute Element subject;
385+ };
386+ </pre>
387+
388+ A {{ViewTimeline}} is an {{AnimationTimeline}}
389+ that specifies a [=view progress timeline=] .
390+ It can be passed to
391+ the {{Animation}} constructor or the {{Animatable/animate()}} method
392+ to link the animation to a [=view progress timeline=] .
393+
394+ <dl class="attributes" dfn-type=attribute dfn-for=ViewTimeline>
395+ : <dfn>subject</dfn>
396+ :: The element whose [=principal box=] ’s visibility in the [=scrollport=]
397+ defines the progress of the timeline.
398+ </dl>
399+
400+ <dl class="constructors">
401+ : <dfn constructor for=ViewTimeline lt="ViewTimeline(options)">ViewTimeline(options)</dfn>
402+ :: Creates a new {{ViewTimeline}} object using the following procedure:
403+
404+ 1. Let |timeline| be the new {{ViewTimeline}} object.
405+
406+ 1. Set the {{ViewTimeline/subject}} and {{ScrollTimeline/axis}} properties of |timeline|
407+ to the corresponding values from |options|.
408+ </dl>
409+
410+ Inherited attributes:
411+
412+ <dl>
413+ : {{ScrollTimeline/source}} (inherited {{ScrollTimeline}}
414+ :: The nearest ancestor of the {{ViewTimeline/subject}}
415+ whose [=principal box=] establishes a [=scroll container=] ,
416+ whose scroll position drives the progress of the timeline.
417+
418+ : {{ScrollTimeline/axis}} (inherited {{ScrollTimeline}}
419+ :: Specifies the axis of scrolling
420+ that drives the progress of the timeline.
421+ See <<axis>> , above.
422+
423+ : {{ScrollTimeline/startTime}} (inherited {{ScrollTimeline}}
424+ :: Represents the starting (0% progress) scroll position
425+ of the [=view progress timeline=]
426+ as its [=scroll container=] ’s scroll offset in ''px''
427+ when the timeline is [=timeline active phase|active=] .
428+ Null when it is [=timeline inactive phase|inactive=] .
429+
430+ : {{ScrollTimeline/endTime}} (inherited from {{ScrollTimeline}}
431+ :: Represents the ending (100%) scroll position
432+ of the [=view progress timeline=]
433+ as its [=scroll container=] ’s scroll offset in ''px''
434+ when the timeline is [=timeline active phase|active=] .
435+ Null when it is [=timeline inactive phase|inactive=] .
436+
437+ : {{AnimationTimeline/currentTime}} (inherited from {{AnimationTimeline}}
438+ :: Represents the current progress
439+ of the [=view progress timeline=]
440+ as its [=scroll container=] ’s scroll offset in ''px''
441+ when the timeline is [=timeline active phase|active=] .
442+ Null when it is [=timeline inactive phase|inactive=] .
443+ </dl>
444+
445+ If the {{ScrollTimeline/source}} or {{ViewTimeline/subject}} of a {{ViewTimeline}}
446+ is an element whose [=principal box=] does not exist
447+ or is not a [=scroll container=] ,
448+ then the {{AnimationTimeline/phase}} is the [=timeline inactive phase=] .
449+ It is otherwise in the [=timeline active phase|active=] phase.
450+
451+ ISSUE: Figure out how to incorporate fit/inset abilities.
452+
453+ ## Named View Progress Timelines ## {#view-timelines-named}
454+
455+ View timelines can also be defined declaratively
456+ and then referenced by name.
326457 See [[#timeline-scope]] .
327458
328- ## Naming a View Progress Timeline: the 'view-timeline-name' property ## {#view-timeline-name}
459+ ### Naming a View Progress Timeline: the 'view-timeline-name' property # ## {#view-timeline-name}
329460
330461 <pre class='propdef'>
331462 Name : view-timeline-name
@@ -344,7 +475,7 @@ spec: cssom-view-1; type: dfn;
344475 determines the number of [=view progress timelines=]
345476 associated with this element.
346477
347- ## Axis of a View Progress Timeline: the 'view-timeline-axis' property ## {#view-timeline-axis}
478+ ### Axis of a View Progress Timeline: the 'view-timeline-axis' property # ## {#view-timeline-axis}
348479
349480 <pre class='propdef'>
350481 Name : view-timeline-axis
@@ -364,7 +495,7 @@ spec: cssom-view-1; type: dfn;
364495 If 'view-timeline-name' has fewer names than 'view-timeline-axis' has specified axes,
365496 the used 'view-timeline-axis' list is truncated.
366497
367- ## Inset of a View Progress Timeline: the 'view-timeline-inset' property ## {#view-timeline-inset}
498+ ### Inset of a View Progress Timeline: the 'view-timeline-inset' property # ## {#view-timeline-inset}
368499
369500 <pre class='propdef'>
370501 Name : view-timeline-inset
@@ -400,7 +531,7 @@ spec: cssom-view-1; type: dfn;
400531
401532 ISSUE: Do we need all the longhands? Seems like overkill...
402533
403- ## Fit of a View Progress Timeline: the 'view-timeline-fit' property ## {#view-timeline-fit}
534+ ### Fit of a View Progress Timeline: the 'view-timeline-fit' property # ## {#view-timeline-fit}
404535
405536 <pre class='propdef'>
406537 Name : view-timeline-fit
@@ -456,7 +587,7 @@ spec: cssom-view-1; type: dfn;
456587 If 'view-timeline-name' has fewer names than 'view-timeline-axis' has specified axes,
457588 the used 'view-timeline-fit' list is truncated.
458589
459- ## View Timeline Shorthand: the 'view-timeline' shorthand ## {#view-timeline-shorthand}
590+ ### View Timeline Shorthand: the 'view-timeline' shorthand # ## {#view-timeline-shorthand}
460591
461592 <pre class='propdef shorthand'>
462593 Name : view-timeline
0 commit comments