Skip to content

Commit 9bc2f6e

Browse files
committed
[css-timing-1] Replace frames() timing function with jump-* keywords
This closes #1680.
1 parent c372656 commit 9bc2f6e

File tree

3 files changed

+183
-301
lines changed

3 files changed

+183
-301
lines changed

css-timing-1/Overview.bs

+63-76
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ The syntax for specifying a [=timing function=] is as follows:
9292
<div class="prod"><dfn type>&lt;timing-function&gt;</dfn> =
9393
''linear'' |
9494
<<cubic-bezier-timing-function>> |
95-
<<step-timing-function>> |
96-
<<frames-timing-function>></div>
95+
<<step-timing-function>></div>
9796

9897

9998
The linear timing function: ''linear'' {#linear-timing-function-section}
@@ -227,10 +226,15 @@ Some example step timing functions are illustrated below.
227226
</figure>
228227

229228
A [=step timing function=] is defined by a non-zero positive number of
230-
<dfn>steps</dfn>, and a <dfn>step position</dfn> property that may be either
231-
<a value for="steps()">start</a> or <a value for="steps()">end</a>.
232-
233-
At the exact point where a step occurs the result of the function is
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.
236+
237+
At the exact point where a step occurs, the result of the function is
234238
conceptually the top of the step. However, an additional <dfn>before flag</dfn>
235239
passed as input to the [=step timing function=], if true, will cause the
236240
result of the function to correspond to the bottom of the step at the step
@@ -242,7 +246,12 @@ and [=before flag=] as follows:
242246
1. Calculate the <var>current step</var> as <code>floor([=input progress
243247
value=] &times; [=steps=])</code>.
244248

245-
1. If the [=step position=] property is <a value for="steps()">start</a>,
249+
1. If the [=step position=] property is one of:
250+
251+
* <a value for="steps()">jump-start</a>,
252+
* <a value for="steps()">start</a>, or
253+
* <a value for="steps()">jump-both</a>,
254+
246255
increment <var>current step</var> by one.
247256

248257
1. If <em>both</em> of the following conditions are true:
@@ -257,30 +266,43 @@ and [=before flag=] as follows:
257266
1. If [=input progress value=] &ge; 0 and <var>current step</var> &lt; 0,
258267
let <var>current step</var> be zero.
259268

269+
1. Calculate |jumps| based on the [=step position=] as follows:
270+
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>
275+
:: [=steps=]
276+
: <a value for="steps()">jump-none</a>
277+
:: [=steps=] - 1
278+
: <a value for="steps()">jump-both</a>
279+
:: [=steps=] + 1
280+
260281
1. If [=input progress value=] &le; 1 and <var>current step</var> &gt;
261-
[=steps=], let <var>current step</var> be [=steps=].
282+
|jumps|, let <var>current step</var> be |jumps|.
262283

263284
<div class=note>
264285

265-
Steps 4 and 5 in this procedure ensure that given an [=input progress
286+
Steps 5 and 6 in this procedure ensure that given an [=input progress
266287
value=] in the range [0, 1], a step timing function does not produce an
267288
[=output progress value=] outside that range.
268289

269290
For example, although mathematically we might expect that a step timing
270291
function with a [=step position=] of <a value for="steps()">start</a>
271-
would step up when the [=input progress value=] is 1, intuitively, when we
272-
apply such a timing function to a forwards-filling animation, we expect
273-
it to produce an [=output progress value=] of 1 as the animation fills
274-
forwards.
292+
would step up (i.e. beyond 1) when the [=input progress value=] is 1,
293+
intuitively,
294+
when we apply such a timing function to a forwards-filling animation,
295+
we expect it to produce an [=output progress value=] of 1
296+
as the animation fills forwards.
275297

276298
A similar situation arises for a step timing function with a [=step
277299
position=] of <a value for="steps()">end</a> when applied to an animation
278300
during its delay phase.
279301

280302
</div>
281303

282-
1. The [=output progress value=] is <code><var>current step</var>
283-
/ [=steps=]</code>.
304+
1. The [=output progress value=] is <code><var>current step</var> /
305+
|jumps|</code>.
284306

285307
<div class=example>
286308

@@ -308,10 +330,16 @@ the result of the timing function will correspond to the top of the first step.
308330

309331
The syntax for specifying a step timing function is as follows:
310332

311-
<div class="prod"><dfn type>&lt;step-timing-function&gt;</dfn> =
333+
<div class="prod">
334+
<dfn type>&lt;step-position&gt;</dfn> =
335+
''jump-start'' | ''jump-end'' |
336+
''jump-none'' | ''jump-both'' |
337+
''start'' | ''end''
338+
339+
<dfn type>&lt;step-timing-function&gt;</dfn> =
312340
''step-start'' | ''step-end'' |
313341
<span class="atom"><a lt="steps()" function>steps</a>(<<integer>>[,
314-
[ ''start'' | ''end'' ] ]?)</span></div>
342+
<<step-position>>]?)</span></div>
315343

316344
The meaning of each value is as follows:
317345

@@ -321,69 +349,27 @@ The meaning of each value is as follows:
321349
:: Equivalent to steps(1, start);
322350
: <dfn>step-end</dfn>
323351
:: Equivalent to steps(1, end);
324-
: <dfn function lt="steps()">steps(&lt;integer&gt;[, [ start | end ] ]?)</dfn>
352+
: <dfn function lt="steps()">steps(&lt;integer&gt;[, &lt;step-position&gt; ]?)</dfn>
325353
:: Specifies a <a>step timing function</a>.
326-
The first parameter specifies the number of intervals in the function.
327-
It must be a positive integer greater than 0.
328-
The second parameter, which is optional, is
329-
either the value <dfn value for="steps()">start</dfn> or <dfn value
330-
for="steps()">end</dfn>, and specifies the [=step position=].
331-
If the second parameter is omitted, it is given the value ''end''.
332354

333-
</dl>
334-
335-
Frames timing functions: ''frames()'' {#frames-timing-functions}
336-
----------------------------------------------------------------
337-
338-
A <dfn>frames timing function</dfn> is a type of <a>timing function</a>
339-
that divides the input time into a specified number of intervals of equal
340-
length, each of which is associated with an <a>output progress value</a> of
341-
increasing value.
342-
The difference between a [=frames timing function=] and a [=step timing
343-
function=] is that a frames timing function returns the [=output progress
344-
values=] 0 and 1 for an equal portion of the [=input progress values=] in
345-
the range [0, 1].
346-
This makes it suitable, for example, for using in animation loops where the
347-
animation should display the first and last frame of the animation for an equal
348-
amount of time as each other frame during each loop.
349-
350-
Some example frames timing functions are illustrated below.
351-
352-
<figure>
353-
<img src="frames-timing-func-examples.svg" width="500"
354-
alt="Example frames timing functions.">
355-
<figcaption>
356-
Example frames timing functions.
357-
In each case the domain is the input progress whilst the range
358-
represents the output progress produced by the function.
359-
</figcaption>
360-
</figure>
361-
362-
A [=frames timing function=] is defined by an integral number of
363-
<dfn>frames</dfn> greater than one.
364-
365-
As with [=step timing functions=], at the exact point where a step occurs the
366-
result of the function is conceptually the top of the step.
367-
368-
The [=output progress value=] is calculated from the [=input progress value=]
369-
as follows:
370-
371-
1. Calculate the <var>current frame</var> as <code>floor([=input progress
372-
value=] &times; [=frames=])</code>.
373-
374-
1. Let the initial [=output progress value=] be <code><var>current frame</var>
375-
/ ([=frames=] - 1)</code>.
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.
376359

377-
1. If [=input progress value=] &le; 1 and [=output progress value=] &gt; 1,
378-
let [=output progress value=] be 1.
360+
The second parameter, which is optional, specifies the [=step position=]
361+
using one of the following values:
379362

380-
The syntax for specifying a frames timing function is as follows:
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>
381369

382-
<div class="prod"><dfn type>&lt;frames-timing-function&gt;</dfn> =
383-
<span class="atom"><dfn lt="frames()" function>frames(<<integer>>)</dfn></span></div>
370+
If the second parameter is omitted, it is given the value ''end''.
384371

385-
The parameter to the function specifies the number of [=frames=].
386-
It must be a positive integer greater than 1.
372+
</dl>
387373

388374

389375
Serialization {#serializing-a-timing-function}
@@ -401,11 +387,12 @@ defined in [[CSSOM]] with the following additional requirements:
401387
''steps()'' function or either of the ''step-start'' or ''step-end''
402388
keywords, are serialized as follows:
403389

404-
1. If the [=step position=] is ''end'', serialize
390+
1. If the [=step position=] is ''jump-end'' or ''end'', serialize
405391
as <a lt="steps()" function>steps(&lt;integer&gt;)</a>.
406392

407393
2. Otherwise, serialize as <a lt="steps()"
408-
function>steps(&lt;integer&gt;, start)</a>.
394+
function>steps(&lt;integer&gt;, &lt;step-position&gt;)</a>.
395+
409396

410397
Acknowledgements {#acknowledgements}
411398
================

css-timing-1/frames-timing-func-examples.svg

-164
This file was deleted.

0 commit comments

Comments
 (0)