W3C home > Mailing lists > Public > www-svg@w3.org > March 2011

Proposal: Change end attribute behaviour

From: Brian Birtles <birtles@gmail.com>
Date: Fri, 25 Mar 2011 12:25:45 +0900
Message-ID: <AANLkTikp_n4XryFNdUE_NT1QDZqXjX9CL11H7D9Z=api@mail.gmail.com>
To: www-svg <www-svg@w3.org>
Dear all,

I would like to propose an amendment to SVG regarding the behaviour of
the end attribute.

Currently SMIL 3.0 requires that, when establishing an interval, if an
end-attribute is specified then either:

* a matching end instance must be found (not just the end of the
active duration), or
* the end attribute must specify an event condition (e.g. "a.click"), or
* the list of end instances must be empty

Otherwise an interval cannot be formed.

Specifically, this piece of pseudocode:

   If there was no end attribute specified
      // this calculates the active end with no end constraint
      tempEnd = calcActiveEnd( tempBegin );
   else
   {
      // We have a begin value - get an end
      Set tempEnd = the first value in the end list that is >= tempBegin.
      // Allow for non-0-duration interval that begins immediately
      // after a 0-duration interval.
      If tempEnd == currentInterval.end
      {
         set tempEnd to the next value in the end list that is > tempEnd
      }
      If there is no such value
      {
         // Events leave the end open-ended. If there are other conditions
         // that have not yet generated instances, they must be unresolved.
         if endHasEventConditions()
            OR if the instance list is empty
            tempEnd = UNRESOLVED;
         // if all ends are before the begin, bad interval
         else
            return FAILURE;
      }
      // this calculates the active dur with an end constraint
      tempEnd = calcActiveEnd( tempBegin, tempEnd );
   }
[1]

I find this to be confusing for authors as the presence of a single
end time or end instance changes the behaviour considerably:

  <animate begin="1s; 3s" ... /> --> 2 intervals
  <animate begin="1s; 3s" end="2s" .../> --> 1 interval

Furthermore, the behaviour will differ if we have end="a.begin" versus
end="a.beginEvent" since only the latter has event conditions.

Also, in the second case, even with beginElement() it is impossible to
start the animation after t=2s.

This condition also contributes to a problem with reset behaviour.
Consider the following element:

  <animate begin="1s" end="2s" ... />

At time t=3s the following sequence of calls is performed:

  beginElementAt(1);
  endElementAt(2);

This results in an interval being created from 4-5s. However, when the
interval is begun at t=4s, a reset is performed,[2] the end instance
time is deleted, and, based on this condition, the interval will also
be deleted (note that begin instance times are fixed once an interval
is begun but end instance times are not).
This has been discussed previously on www-smil[3] where it was
acknowledged as an issue.[4]

A test case is available here: http://brian.sol1.net/svg/interop/reset-test.svg

(There is also a further acknowledged issue with this pseudocode that
if an end instance time exists (perhaps added by endElement) we should
behave as if an end attribute were specified.[5])

Proposed change
---------------

In essence, I'd like to change this piece of pseudocode:

         // Events leave the end open-ended. If there are other conditions
         // that have not yet generated instances, they must be unresolved.
         if endHasEventConditions()
            OR if the instance list is empty
            tempEnd = UNRESOLVED;
         // if all ends are before the begin, bad interval
         else
            return FAILURE;

to simply:

         tempEnd = UNRESOLVED;

But that's perhaps most easily achieved by changing the description of
the end attribute.[6] Specifically append to the following text:

  A value of 'indefinite' specifies that the end of the animation will
  be determined by an endElement method call (the animation DOM methods
  are described in DOM interfaces).

an additional sentence:

  In SVG, unlike SMIL Animation, the end attribute is always considered
  to include the 'indefinite' value as the last item in the list of end
  values, whether it is explicitly specified or not.

Interoperability
---------------

I haven't done a proper study yet of how well these restrictions are
implemented. From some simple testing of Opera, a recent WebKit
nightly, and Firefox:
* All apply the specified restriction for the first example given
* Opera and WebKit do not appear to delete the second interval in the
reset example.

Your feedback is most appreciated (although please excuse me that I
may be unable to respond for the next week).

Best regards,

Brian Birtles

[1] http://www.w3.org/TR/SMIL/smil-timing.html#q94
[2] Reset is performed when the interval is begun. See
http://lists.w3.org/Archives/Public/www-smil/2009OctDec/0004.html
[3] http://lists.w3.org/Archives/Public/www-smil/2009OctDec/0002.html
[4] http://lists.w3.org/Archives/Public/www-smil/2009OctDec/0004.html
[5] http://lists.w3.org/Archives/Public/www-smil/2010JanMar/0000.html
[6] http://dev.w3.org/SVG/profiles/1.1F2/publish/animate.html#EndAttribute
Received on Friday, 25 March 2011 03:26:19 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:47 GMT