@@ -209,47 +209,131 @@ Step timing functions: ''step-start'', ''step-end'', ''steps()'' {#step-timing-f
209209A <dfn>step timing function</dfn> is a type of <a>timing function</a>
210210that divides the input time into a specified number of intervals that
211211are equal in length.
212+ It is defined by a number of <dfn>steps</dfn> , and a <dfn>step position</dfn> .
213+ It has following syntax:
212214
213- Some example step timing functions are illustrated below.
215+ <div class="prod">
216+ <dfn type><step-timing-function></dfn> =
217+ ''step-start'' | ''step-end'' |
218+ <span class="atom"> <a lt="steps()" function>steps</a> (<<integer>> [,
219+ <<step-position>> ]?)</span>
214220
215- <figure>
216- <img src="step-timing-func-examples.svg" width="500"
217- alt="Example step timing functions.">
218- <figcaption>
219- Example step timing functions.
220- In each case the domain is the input progress whilst the range
221- represents the output progress produced by the step function.<br>
222- The first row shows the function for each transition point when only
223- one step is specified whilst the second row shows the same for three
224- steps.
225- </figcaption>
226- </figure>
221+ <dfn type><step-position></dfn> =
222+ ''jump-start'' | ''jump-end'' |
223+ ''jump-none'' | ''jump-both'' |
224+ ''start'' | ''end'' </div>
225+
226+ The meaning of each value is as follows:
227+
228+ <dl dfn-type=value dfn-for="step-timing-function, <step-timing-function> ">
229+
230+ : <dfn>step-start</dfn>
231+ :: Computes to ''steps(1, start)''
232+ : <dfn>step-end</dfn>
233+ :: Computes to ''steps(1, end)''
234+
235+ <figure>
236+ <img src="step-timing-keyword-examples.svg" width="500"
237+ alt="Example step timing keywords.">
238+ <figcaption>
239+ Example step timing function keyword values.
240+ </figcaption>
241+ </figure>
242+
243+ : <dfn function lt="steps()">steps(<integer>[, <step-position> ]?)</dfn>
244+ :: The first parameter specifies the number of intervals in the function.
245+ It must be a positive integer greater than 0
246+ unless the second parameter is <a value for="steps()">jump-none</a>
247+ in which case it must be a positive integer greater than 1.
248+
249+ The second parameter, which is optional, specifies the [=step position=]
250+ using one of the following values:
251+
252+ <dl dfn-type=value dfn-for="step-position, <step-position> ">
253+
254+ : <dfn value for="steps()">jump-start</dfn>
255+ :: The first rise occurs at [=input progress value=] of 0.
256+ : <dfn value for="steps()">jump-end</dfn>
257+ :: The last rise occurs at [=input progress value=] of 1.
258+ : <dfn value for="steps()">jump-none</dfn>
259+ :: All rises occur within the range (0, 1).
260+ : <dfn value for="steps()">jump-both</dfn>
261+ :: The first rise occurs at [=input progress value=] of 0
262+ and the last rise occurs at [=input progress value=] of 1.
263+ : <dfn value for="steps()">start</dfn>
264+ :: Behaves as <a value for="steps()">jump-start</a> .
265+ : <dfn value for="steps()">end</dfn>
266+ :: Behaves as <a value for="steps()">jump-end</a> .
227267
228- A [=step timing function=] is defined by a non-zero positive number of
229- <dfn>steps</dfn> , and a <dfn>step position</dfn> property that may one of:
230- <a value for="steps()">jump-start</a> ,
231- <a value for="steps()">jump-end</a> ,
232- <a value for="steps()">jump-none</a> , or
233- <a value for="steps()">jump-both</a> , or the legacy
234- <a value for="steps()">start</a> or
235- <a value for="steps()">end</a> values.
268+ </dl>
269+
270+ If the second parameter is omitted, the value ''end'' is assumed.
271+
272+ These values are illustrated below:
273+
274+ <figure>
275+ <img src="step-timing-func-examples.svg" width="500"
276+ alt="Example step timing functions.">
277+ <figcaption>
278+ Example step timing functions.
279+ </figcaption>
280+ </figure>
281+
282+ </dl>
283+
284+ ### Output of a step timing function ### {#step-timing-function-algo}
236285
237286At the exact point where a step occurs, the result of the function is
238287conceptually the top of the step. However, an additional <dfn>before flag</dfn>
239288passed as input to the [=step timing function=] , if true, will cause the
240289result of the function to correspond to the bottom of the step at the step
241290point.
242291
292+ <div class=example>
293+
294+ As an example of how the [=before flag=] affects the behavior of this function,
295+ consider an animation with a [=step timing function=] whose [=step
296+ position=] is <a value for="steps()">start</a> and which has a positive
297+ delay and backwards fill.
298+
299+ For example, using CSS animation:
300+
301+ <pre class='lang-css'>
302+ animation: moveRight 5s 1s steps(5, start);
303+ </pre>
304+
305+ During the delay phase, the [=input progress value=] will be zero but if the
306+ [=before flag=] is set to indicate that the animation has yet to reach its
307+ animation interval, the timing function will produce zero as its [=output
308+ progress value=] , i.e. the bottom of the first step.
309+
310+ At the exact moment when the animation interval begins, the [=input progress
311+ value=] will still be zero, but the [=before flag=] will not be set and hence
312+ the result of the timing function will correspond to the top of the first step.
313+
314+ </div>
315+
316+ For the purposes of calculating the [=output progress value=] , the
317+ [=step position=] <a value for="steps()">start</a> is considered equivalent to
318+ <a value for="steps()">jump-start</a> .
319+ Likewise <a value for="steps()">end</a> is considered equivalent to <a value
320+ for="steps()">jump-end</a> .
321+ As a result, the following algorithm does not make explicit reference to
322+ <a value for="steps()">start</a> or <a value for="steps()">end</a> .
323+
324+ Note: User agents must still differentiate between
325+ <a value for="steps()">jump-start</a> and <a value for="steps()">start</a> for
326+ the purpose of serialization (see [[#serializing-a-timing-function]] ).
327+
243328The [=output progress value=] is calculated from the [=input progress value=]
244329and [=before flag=] as follows:
245330
246- 1. Calculate the <var> current step</var> as <code> floor( [=input progress
247- value=] × [=steps=] )</code> .
331+ 1. Calculate the <var> current step</var> as
332+ <code> floor( [=input progress value=] × [=steps=] )</code> .
248333
2493341. If the [=step position=] property is one of:
250335
251336 * <a value for="steps()">jump-start</a> ,
252- * <a value for="steps()">start</a> , or
253337 * <a value for="steps()">jump-both</a> ,
254338
255339 increment <var> current step</var> by one.
@@ -268,10 +352,8 @@ and [=before flag=] as follows:
268352
2693531. Calculate |jumps| based on the [=step position=] as follows:
270354
271- : <a value for="steps()">jump-start</a> ,
272- <a value for="steps()">start</a> ,
273- <a value for="steps()">jump-end</a> , or
274- <a value for="steps()">end</a>
355+ : <a value for="steps()">jump-start</a> or
356+ <a value for="steps()">jump-end</a>
275357 :: [=steps=]
276358 : <a value for="steps()">jump-none</a>
277359 :: [=steps=] - 1
@@ -288,89 +370,22 @@ and [=before flag=] as follows:
288370 [=output progress value=] outside that range.
289371
290372 For example, although mathematically we might expect that a step timing
291- function with a [=step position=] of <a value for="steps()">start</a>
373+ function with a [=step position=] of <a value for="steps()">jump- start</a>
292374 would step up (i.e. beyond 1) when the [=input progress value=] is 1,
293375 intuitively,
294376 when we apply such a timing function to a forwards-filling animation,
295377 we expect it to produce an [=output progress value=] of 1
296378 as the animation fills forwards.
297379
298- A similar situation arises for a step timing function with a [=step
299- position=] of <a value for="steps()">end</a> when applied to an animation
300- during its delay phase.
380+ A similar situation arises for a step timing function with
381+ a [=step position=] of <a value for="steps()">jump- end</a>
382+ when applied to an animation during its delay phase.
301383
302384 </div>
303385
3043861. The [=output progress value=] is <code><var> current step</var> /
305387 |jumps|</code> .
306388
307- <div class=example>
308-
309- As an example of how the [=before flag=] affects the behavior of this function,
310- consider an animation with a [=step timing function=] whose [=step
311- position=] is <a value for="steps()">start</a> and which has a positive
312- delay and backwards fill.
313-
314- For example, using CSS animation:
315-
316- <pre class='lang-css'>
317- animation: moveRight 5s 1s steps(5, start);
318- </pre>
319-
320- During the delay phase, the [=input progress value=] will be zero but if the
321- [=before flag=] is set to indicate that the animation has yet to reach its
322- animation interval, the timing function will produce zero as its [=output
323- progress value=] , i.e. the bottom of the first step.
324-
325- At the exact moment when the animation interval begins, the [=input progress
326- value=] will still be zero, but the [=before flag=] will not be set and hence
327- the result of the timing function will correspond to the top of the first step.
328-
329- </div>
330-
331- The syntax for specifying a step timing function is as follows:
332-
333- <div class="prod">
334- <dfn type><step-position></dfn> =
335- ''jump-start'' | ''jump-end'' |
336- ''jump-none'' | ''jump-both'' |
337- ''start'' | ''end''
338-
339- <dfn type><step-timing-function></dfn> =
340- ''step-start'' | ''step-end'' |
341- <span class="atom"> <a lt="steps()" function>steps</a> (<<integer>> [,
342- <<step-position>> ]?)</span></div>
343-
344- The meaning of each value is as follows:
345-
346- <dl dfn-type=value dfn-for="step-timing-function, <step-timing-function> ">
347-
348- : <dfn>step-start</dfn>
349- :: Equivalent to steps(1, start);
350- : <dfn>step-end</dfn>
351- :: Equivalent to steps(1, end);
352- : <dfn function lt="steps()">steps(<integer>[, <step-position> ]?)</dfn>
353- :: Specifies a <a>step timing function</a> .
354-
355- The first parameter specifies the number of intervals in the function.
356- It must be a positive integer greater than 0
357- unless the second parameter is <a value for="steps()">jump-none</a>
358- in which case it must be a positive integer greather than 1.
359-
360- The second parameter, which is optional, specifies the [=step position=]
361- using one of the following values:
362-
363- * <dfn value for="steps()">jump-start</dfn>
364- * <dfn value for="steps()">jump-end</dfn>
365- * <dfn value for="steps()">jump-none</dfn>
366- * <dfn value for="steps()">jump-both</dfn>
367- * <dfn value for="steps()">start</dfn>
368- * <dfn value for="steps()">end</dfn>
369-
370- If the second parameter is omitted, it is given the value ''end'' .
371-
372- </dl>
373-
374389
375390Serialization {#serializing-a-timing-function}
376391-------------
0 commit comments