Following are a couple of issues I’ve come across with regards to
In section 3.2.3 of the SMIL Animation specification the
keyTimesattribute is described and the following constraint is given:
For linear and spline animation, the first time value in the list must be 0, and the last time value in the list must be 1.
Later in that section, the following example is given:
<animate attributeName="foo" from="10" to="20" dur="10s" keyTimes="0.0; 0.7" calcMode="spline" keySplines=".5 0 .5 1" />
The behaviour of the example is given as “The
keyTimesvalues cause the value of 20 to be reached at 7 seconds, and to hold there for the remainder of the 10 second simple duration.”
This seems to contradict the constraint provided earlier. Perhaps this is a special case for from-to animation but I can’t find a reference to such an exception elsewhere.
In the patch I’ve prepared I have a
#define (ALLOW_BAD_KEYTIMES). If this is defined then no constraint checking is performed and specs such as
keyTimes="0.0; 0.7"or even
keyTimes="0.3; 0.9"are allowed and provide the behaviour described above.
I think it is reasonable to allow this behaviour because:
- There is an example using this notation in the spec and many authors will just copy the code examples rather than reading the spec.
- The behaviour in this case is quite obvious. From memory Opera and ASV allow it but I’ll have another look soon.
In the same section (3.2.3) the following example is given of the keyTimes attribute:
<animateColor attributeName="color" dur="10s" calcMode="discrete" values="green; yellow; red" keyTimes="0.0; 0.5;" />
Firstly, the trailing semi-colon in the
keyTimesvalue seems out of place but perhaps it is my understanding of the following explanation that is at fault:
This example also shows how
keyTimesvalues can interact with an indefinite duration. The value of the “color” attribute will be set to green for 5 seconds, and then to yellow for 5 seconds, and then will remain red for the remainder of the document, since the (unspecified) duration defaults to“indefinite”.
I first thought that perhaps the “unspecified duration” referred to the missing keyTime but nowhere else is it mentioned that
keyTimescan be indefinite. Furthermore I would not expect that such a keyTime specification can extend the duration of the element beyond its specified duration of 10s but the description says it “will remain red for the remainder of the document.”
I’ve posted these questions to email@example.com but so far haven’t received any response.
Your help is greatly appreciated! Please leave a comment if you have any suggestions.