W3C home > Mailing lists > Public > www-smil@w3.org > January to March 2011

Proposal: Fix discrete to animation in SVG 1.1 Second Edition

From: Brian Birtles <birtles@gmail.com>
Date: Tue, 8 Mar 2011 11:56:08 +0900
Message-ID: <AANLkTingQbEvUp_FxdQp1D3cTknT=HHYCHNDmS8qmYF-@mail.gmail.com>
To: www-svg <www-svg@w3.org>
Cc: www-smil@w3.org
Dear www-svg,

I would like to propose a change to the behaviour specified for
discrete to-animation in SVG 1.1 Second Edition.

Problem:
--------

According to SMIL Animation which is a normative reference for SVG 1.1
Second Edition:

  For the shorthand form to animation, there is only 1 value; a
discrete to animation will simply set the "to" value for the simple
duration.[1]

That means that the following two fragments will behave markedly differently:

  <rect width="100" height="50">
    <animate attributeName="width"
             calcMode="discrete"
             begin="0s" dur="2s"
             from="100"
             to="300"
             fill="freeze"/>
  </rect>

and:

  <rect width="100" height="50">
    <animate attributeName="width"
             calcMode="discrete"
             begin="0s" dur="2s"
             to="300"
             fill="freeze"/>
  </rect>

(Online test case here:
https://bug544855.bugzilla.mozilla.org/attachment.cgi?id=493392
although note that the order of animation is reversed.)

The first, a discrete from-to animation will set the width to 100 for
1s, and 300 for 1s (and onwards due to fill behaviour).

The second, a discrete to animation will set the width to 300s from the start.

This seems very confusing for authors who are not also SMIL model experts.

This issue was raised a year ago by Julien Reichel who pointed out
that animate-elem-227-t.svg mandates the wrong behaviour[2] and also
by Dr. Olaf Hoffman and Julien on several occasions prior.[3]

Proposed change:
----------------

In section 19.2.9 'Attributes that define animation values over time'
change the paragraph:

  The processing rules for the variants of from/by/to animations are described
  in Animation function values.

to:

  The processing rules for the variants of from/by/to animations are
  described in Animation function values with the following exception.

  In order to provide intuitive and consistent behavior when the starting
  value of an animation is explicitly specified by a "from" attribute (e.g.
  "from-to animation") and when the underlying value is used (e.g. "to
  animation") the behavior of discrete to-animation in SVG deviates from the
  definition in SMIL Animation.

  As with a discrete from-to animatiom, a discrete to animation will set the
  underlying value for the first half of the simple duration (or, if a
  keyTimes list is provided, until the offset into the simple duration
  specified by the second value in the keyTimes list) and the "to" value for
  the remainder of the simple duration.

I've tried to follow the wording of SMIL Animation 3.2.3[1] although I
note that the wording of SMIL Animation at this point seems to neglect
the possibility of keyTimes being specified (unless "half" is not
meant literally).

(For the record, from/to/by syntax can be used in conjunction with keyTimes.[4])

If we want to use formulae like SMIL 3 uses we could have:

  When no keyTimes attribute is specified, d_1 is the mid-point of the simple
  duration, d/2. Otherwise d_1 = keyTimes[1].

  The simple animation function for discrete to-animation is then:
    f(t,u) = u, for t: 0 <= t < d_1
    f(t,u) = v_t, for t: d_1 <= t <= d

Interoperability:
-----------------

Opera 11.01, Batik 1.7, and WebKit nightly build r80213 (3 Mar 2011)
all provide identical animation for both of the provided examples.
i.e. they do not conform to the specified behaviour but follow this
proposal.

(I note however that Opera and WebKit appear to ignore keyTimes in this case.)

Apparently ASV also does not follow the specified behaviour.[5]

Firefox 4 will ship with the behaviour specified by SMIL Animation. If
this proposal is accepted however we will revert the behaviour before
the next major release.

I raised this issue at last week's F2F and most people seemed to
agree. I assumed it was too late to fix this in SVG 1.1 Second Edition
but perhaps that is not the case after all.

Rationale:
----------

* The proposed change makes the behaviour of discrete from-to/to
animation analogous to linear from-to/to animation and hence more
intuitive.
* The rationale for the currently specified behaviour is unclear.[6]
* The fact that test animate-elem-227-t.svg mandates the wrong
behaviour is evidence that this is confusing.
* The specified behaviour is largely unimplemented and hence changing
it should not break large amounts of existing content.
* The behaviour of setting the to-value for the entire duration can be
achieved with <set>.

This issue has come up many times before, let's fix it now. Any
objections or corrections to my proposal are very welcome.

I hope, in the coming days to provide a similar write-up for a couple
of the other minor issues raised at last week's F2F.[7]

Regards,

Brian Birtles

[1] http://www.w3.org/TR/2001/REC-smil-animation-20010904/#AnimFuncValues
[2] http://lists.w3.org/Archives/Public/www-svg/2010Feb/0015.html
[3] http://lists.w3.org/Archives/Public/www-smil/2008JanMar/0040.html
and following thread:
    http://lists.w3.org/Archives/Public/www-smil/2008JulSep/0001.html, and
    http://lists.w3.org/Archives/Public/www-svg/2008Sep/0027.html
[4] http://www.w3.org/TR/SMIL/smil-animation.html#animationNS-InterpolationKeysplines
[5] http://lists.w3.org/Archives/Public/www-svg/2008Sep/0026.html
[6] http://lists.w3.org/Archives/Public/www-smil/2008JulSep/0011.html
[7] http://www.w3.org/Graphics/SVG/WG/wiki/F2F/Auckland_2011/Animation_improvements
Received on Tuesday, 8 March 2011 02:56:41 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 March 2011 02:56:41 GMT