From d18add1ecbec9f4fb0c7105d66cdc14a33c08e94 Mon Sep 17 00:00:00 2001 From: Steve Block Date: Wed, 11 Dec 2013 14:38:23 +1100 Subject: [PATCH 1/2] Remove requirement for loosely sorted keyframes --- index.html | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/index.html b/index.html index d878ad6..971afed 100644 --- a/index.html +++ b/index.html @@ -4194,21 +4194,12 @@

Procedure for evenly distributing keyframes

A procedure for evenly distributing keyframes with unspecified positional offsets is provided below.

-

- Given a list of keyframes whose positional offets are - either a real number in the range [0, 1] or unspecified, - we define such as list as loosely sorted by offset if, for - each keyframe in the list that has a specified offset, the - offset is greater than or equal to the offset of the previous - keyframe in the list with a specified offset, if any. -

Given a list of keyframes, initial keyframe list, - that is loosely sorted by offset we can evenly distribute the - keyframes with unspecified positional offsets between - those frames with specified offsets using the following procedure: + we can evenly distribute the keyframes with unspecified positional offsets + between those frames with specified offsets using the following + procedure:

  1. Let distributed keyframes be a copy of initial @@ -4251,6 +4242,12 @@

    Procedure for evenly distributing keyframes

    * i / (n + 1)

    +
  2. Sort distributed keyframes by the positional offset of + each keyframe such that the partial order of + keyframes with equal positional offsets + remains constant.
  3. Return distributed keyframes.
@@ -7962,19 +7959,13 @@

The KeyframeAnimationEffect interface

defined in .

-

- As a result of the normalization of the list, if frames - is not loosely sorted by offset this effect will not - contribute to the final composited value. -

- +<

Normalizing the list of keyframes

- This behavior is expected to be revised such that keyframe lists - that are not in sequence are accepted and keyframe offsets outside - the range [0, 1] are also allowed. + This behavior is expected to be revised such that keyframe offsets + outside the range [0, 1] are allowed. Doing so may make this procedure unnecessary.

@@ -7988,8 +7979,6 @@

Normalizing the list of keyframes

  1. Let normalized keyframes be a copy of the keyframe list returned by getFrames. -
  2. If normalized keyframes is not loosely sorted by - offset, return an empty list.
  3. If there exist any keyframes whose specified positional offset is less than zero, remove all keyframes from the start of normalized keyframes up to and including the From 10d1f48bf842adddb5044f0bfbfe1c83183cadf8 Mon Sep 17 00:00:00 2001 From: Steve Block Date: Wed, 11 Dec 2013 14:17:49 +1100 Subject: [PATCH 2/2] Allow keyframe offsets outside [0, 1] --- index.html | 176 +++++++++++++++++++++-------------------------------- 1 file changed, 71 insertions(+), 105 deletions(-) diff --git a/index.html b/index.html index 971afed..a7f7c8b 100644 --- a/index.html +++ b/index.html @@ -2909,10 +2909,14 @@

    Normalizing a timing function position list

    An implication of the above two conditions is that no values outside the range [0, 1] are allowed. - If we allow keyframe offsets outside [0, 1] we will need - to allow timing function offsets outside that range too - for consistency.

    +
    +

    + We allow keyframe offsets outside [0, 1] so we + should allow timing function offsets outside that + range too for consistency. +

    +
  4. The normalized timing function position list is simply input positions. @@ -3980,8 +3984,10 @@

    Keyframe animation effects

    a keyframe.

    - The positional offset of a keyframe is a value in the range - [0, 1]. + The positional offset of a keyframe is the point in the + time fraction space of the timed item to which this + keyframe animation effect belongs at which the property values + apply. The list of keyframes for a keyframe animation effect is sorted in ascending order by the positional offset of each @@ -3993,13 +3999,6 @@

    Keyframe animation effects

    Rather, this is achieved by setting a chain of timing functions on the timed item (proposal for this is still in the works).

    -

    - If, due to a timing function specified on the timed - item from which the time fraction is derived, the time - fraction lies outside the range [0, 1], the specified - keyframe property values are extrapolated to cover the extended - range. -

    The behavior when keyframes overlap or have unsupported values is defined in The unaccumulated animation value of a keyframe animation effect target property.

  5. If property-specific keyframes is empty, return underlying value. -
  6. If there is no keyframe with a positional offset of - 0, create a new keyframe with a positional offset of 0, - a property value set to the neutral value for composition, - and a composition operation of add, and add it to the beginning of - property-specific keyframes. -
  7. Similarly, if there is no keyframe with a positional offset of - 1, create a new keyframe with a positional offset of 1, - a property value set to the neutral value for composition, - and a composition operation of add, and append it to the end of - property-specific keyframes. +
  8. If all keyframes in property-specific keyframes + have the same positional offset, generate an additional + keyframe as follows. +
      +
    1. Let offset be the positional offset of + the last keyframe in property-specific + keyframes. +
    2. Create a new keyframe, synthetic keyframe, + with a single target property equal to target + property. +
    3. If offset is 0, set the positional + offset of synthetic keyframe to 1 and the + value and composition operation of synthetic + keyframe to those of the last keyframe in + property-specific keyframes. +
    4. Otherwise, set the positional offset of + synthetic keyframe to 0, the value of + synthetic keyframe to the neutral value for + composition and the composition operation of + synthetic keyframe to composition operation + add. +
    5. Insert synthetic keyframe into + property- specific keyframes such that that it + remains sorted by positional offset. +
    +
  9. Iterate over each keyframe in property-specific keyframes and for each keyframe, if:
      @@ -4088,22 +4099,29 @@

      The unaccumulated animation value of a keyframe animation effect

      underlying value + value to add.
-
  • If time fraction < 0 and there is more - than one keyframe in property-specific - keyframes with a positional offset of 0, return the property - value for target property of the first keyframe - in property-specific keyframes.
  • -
  • If time fraction ≥ 1 and there is more than one - keyframe in property-specific keyframes with - a positional offset of 1, return the property value for - target property of the last keyframe in +
  • +
  • Let minimum offset be the offset of the first entry in property-specific keyframes.
  • -
  • Let start keyframe be the last keyframe in - property-specific keyframes whose positional offset is - less than or equal to time fraction and less than 1. - If there is no such keyframe (because, for example, the - time fraction is negative), let start keyframe - be the last keyframe whose positional offset is 0.
  • +
  • Let maximum offset be the offset of the last entry in + property-specific keyframes.
  • +
  • Assign start keyframe as follows. +
      +
    1. If time fraction < minimum + offset, let start keyframe be the last + keyframe in property-specific keyframes + whose positional offset is equal to minimum + offset. +
    2. If time fractionmaximum + offset, let start keyframe be the last + keyframe in property-specific keyframes + whose positional offset is less than maximum + offset. +
    3. Otherwise let start keyframe be the last + keyframe in property-specific keyframes + whose positional offset is less than or equal to + time fraction. +
    +
  • Let end keyframe be the next keyframe in property-specific keyframes after start keyframe.
  • @@ -4129,8 +4147,7 @@

    The unaccumulated animation value of a keyframe animation effect

    keyframes specified on the effect:

    Procedure for evenly distributing keyframes

    Whilst the Web Animations model assumes a sorted list of keyframes with specified positional offsets in the - range [0, 1] many users of the model require a facility for - automatically distributing keyframes when positional offsets are not - provided. + title="positional offset of a keyframe">positional offsets, many + users of the model require a facility for automatically distributing + keyframes when positional offsets are not provided. A procedure for evenly distributing keyframes with unspecified positional offsets is provided below.

    @@ -7963,11 +7950,6 @@

    The KeyframeAnimationEffect interface

    Normalizing the list of keyframes

    -
    - This behavior is expected to be revised such that keyframe offsets - outside the range [0, 1] are allowed. - Doing so may make this procedure unnecessary. -

    Before passing the list of Keyframes specified in the API to the @@ -7979,16 +7961,6 @@

    Normalizing the list of keyframes

    1. Let normalized keyframes be a copy of the keyframe list returned by getFrames. -
    2. If there exist any keyframes whose specified positional - offset is less than zero, remove all keyframes from the - start of normalized keyframes up to and including the - keyframe with the largest specified positional offset - that is still less than zero. -
    3. Likewise, if there exist any keyframes whose specified - offset is greater than one, remove all keyframes from - keyframe with the smallest specified positional offset - that is still greater than one until the end of - normalized keyframes.
    4. Set the positional offset of any keyframes without a specified offset using the procedure defined in The Keyframe dictionary

      The positional - offset of the keyframe specified as a number between - 0.0 and 1.0 inclusive or null. -

      -

      - Keyframes with offsets outside the range [0.0, 1.0] are - ignored when calculating animation values as defined in - . + offset of the keyframe specified as a number or + null.

      A null value indicates that the keyframe