Skip to content

Commit 285199a

Browse files
committed
[web-animations-1][editorial] Move “animation frame” section out of the timeline definition
No change to text (except headings). This section was making it hard to understand the “Timelines” section because it split the generic dfn from the specific types dfns with a much more complicated concept relating timelines to animations and events and other things. This moves it out of the way, and gives it a higher-level section heading (as it deserves).
1 parent 653c7d2 commit 285199a

File tree

1 file changed

+80
-72
lines changed

1 file changed

+80
-72
lines changed

web-animations-1/Overview.bs

Lines changed: 80 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -690,77 +690,6 @@ Timelines {#timelines}
690690
A [=timeline=] can be
691691
<dfn lt="timeline associated with a document">associated with a document</dfn>.
692692

693-
When asked to <dfn export>update animations and send events</dfn>
694-
for a {{Document}} |doc| at timestamp |now|,
695-
run these steps:
696-
697-
1. Update the [=timeline/current time=] of all timelines
698-
<a lt="timeline associated with a document">associated with |doc|</a>
699-
passing |now| as the timestamp.
700-
701-
<div class=note>
702-
Due to the hierarchical nature of the timing model,
703-
updating the [=timeline/current time=] of a [=timeline=] also involves:
704-
705-
* Updating the [=animation/current time=] of any [=animations=]
706-
[=associated with a timeline|associated with=] the timeline.
707-
708-
* Running the [=update an animation's finished state=] procedure
709-
for any animations whose [=animation/current time=] has been updated.
710-
711-
* Queueing [=animation events=] for any such animations.
712-
</div>
713-
714-
1. [=Remove replaced animations=] for |doc|.
715-
716-
1. [=Perform a microtask checkpoint=].
717-
718-
Note: This is to ensure that any microtasks queued up
719-
as a result of resolving or rejecting Promise objects
720-
as part of updating timelines in the previous step,
721-
run their callbacks prior to dispatching animation events.
722-
723-
1. Let |events to dispatch| be a copy of |doc|'s [=pending animation event queue=].
724-
725-
1. Clear |doc|'s [=pending animation event queue=].
726-
727-
1. Perform a stable sort of the [=animation events=] in |events to dispatch|
728-
as follows:
729-
730-
1. Sort the events by their [=scheduled event time=]
731-
such that events that were scheduled to occur earlier
732-
sort before events scheduled to occur later,
733-
and events whose scheduled event time is [=unresolved=]
734-
sort before events with a [=resolved=]
735-
scheduled event time.
736-
737-
1. Within events with equal [=scheduled event times=],
738-
sort by their [=composite order=].
739-
740-
Note: The purpose of sorting events is to ensure that, as best possible,
741-
even on devices with differing capabilities
742-
and hence different frame rates,
743-
events are dispatched in a consistent order.
744-
745-
Note: The requirement for the sort to be a stable sort
746-
is because sometimes multiple events can be queued
747-
with the same scheduled event time.
748-
For example, a CSS animation with a duration of zero would dispatch
749-
both an <code>animationstart</code> and an <code>animationend</code> event
750-
with the same scheuled event time,
751-
and the order of these events should be preserved.
752-
753-
1. [=Dispatch=] each of the events in |events to dispatch| at their
754-
corresponding target using the order established in the previous step.
755-
756-
It is often convenient to describe each time this procedure is invoked
757-
as establishing a new <dfn export>animation frame</dfn>.
758-
Changes to the timing properties of [=animations=] or [=animation effects=],
759-
or the addition and removal of the objects can
760-
cause the output of the timing or animation model to change,
761-
but these operations in themselves do not create a new [=animation frame=];
762-
rather they merely update the current [=animation frame=].
763-
764693
### Document timelines ### {#document-timelines}
765694

766695
A <dfn export>document timeline</dfn> is a type of [=timeline=]
@@ -793,7 +722,7 @@ Timelines {#timelines}
793722
return the sum of the |timeline time| and |timeline|'s [=origin time=].
794723
If |timeline| is inactive, return an [=unresolved=] [=time value=].
795724

796-
### The default document timeline ### {#the-documents-default-timeline}
725+
#### The default document timeline #### {#the-documents-default-timeline}
797726

798727
Each {{Document}} has a [=document timeline=] called the
799728
<dfn export for="document">default document timeline</dfn>.
@@ -803,6 +732,8 @@ Timelines {#timelines}
803732

804733
The [=default document timeline=] has an [=origin time=] of zero.
805734

735+
#### Relationship to wall-clock time #### {#document-wallclock-time}
736+
806737
<div class=informative-bg>
807738
<em>This section is non-normative</em>
808739

@@ -822,6 +753,83 @@ Timelines {#timelines}
822753

823754
</div>
824755

756+
Animation Frames {#animation-frame-loop}
757+
----------------
758+
759+
<div algorithm>
760+
When asked to <dfn export>update animations and send events</dfn>
761+
for a {{Document}} |doc| at timestamp |now|,
762+
run these steps:
763+
764+
1. Update the [=timeline/current time=] of all timelines
765+
<a lt="timeline associated with a document">associated with |doc|</a>
766+
passing |now| as the timestamp.
767+
768+
<div class=note>
769+
Due to the hierarchical nature of the timing model,
770+
updating the [=timeline/current time=] of a [=timeline=] also involves:
771+
772+
* Updating the [=animation/current time=] of any [=animations=]
773+
[=associated with a timeline|associated with=] the timeline.
774+
775+
* Running the [=update an animation's finished state=] procedure
776+
for any animations whose [=animation/current time=] has been updated.
777+
778+
* Queueing [=animation events=] for any such animations.
779+
780+
</div>
781+
782+
1. [=Remove replaced animations=] for |doc|.
783+
784+
1. [=Perform a microtask checkpoint=].
785+
786+
Note: This is to ensure that any microtasks queued up
787+
as a result of resolving or rejecting Promise objects
788+
as part of updating timelines in the previous step,
789+
run their callbacks prior to dispatching animation events.
790+
791+
1. Let |events to dispatch| be a copy of |doc|'s [=pending animation event queue=].
792+
793+
1. Clear |doc|'s [=pending animation event queue=].
794+
795+
1. Perform a stable sort of the [=animation events=] in |events to dispatch|
796+
as follows:
797+
798+
1. Sort the events by their [=scheduled event time=]
799+
such that events that were scheduled to occur earlier
800+
sort before events scheduled to occur later,
801+
and events whose scheduled event time is [=unresolved=]
802+
sort before events with a [=resolved=]
803+
scheduled event time.
804+
805+
1. Within events with equal [=scheduled event times=],
806+
sort by their [=composite order=].
807+
808+
Note: The purpose of sorting events is to ensure that, as best possible,
809+
even on devices with differing capabilities
810+
and hence different frame rates,
811+
events are dispatched in a consistent order.
812+
813+
Note: The requirement for the sort to be a stable sort
814+
is because sometimes multiple events can be queued
815+
with the same scheduled event time.
816+
For example, a CSS animation with a duration of zero would dispatch
817+
both an <code>animationstart</code> and an <code>animationend</code> event
818+
with the same scheuled event time,
819+
and the order of these events should be preserved.
820+
821+
1. [=Dispatch=] each of the events in |events to dispatch| at their
822+
corresponding target using the order established in the previous step.
823+
</div>
824+
825+
It is often convenient to describe each time this procedure is invoked
826+
as establishing a new <dfn export>animation frame</dfn>.
827+
Changes to the timing properties of [=animations=] or [=animation effects=],
828+
or the addition and removal of the objects can
829+
cause the output of the timing or animation model to change,
830+
but these operations in themselves do not create a new [=animation frame=];
831+
rather they merely update the current [=animation frame=].
832+
825833
Animations {#animations}
826834
----------
827835

0 commit comments

Comments
 (0)