Events when adding and removing animation elements in play

Dear all,

I wish to clarify the expected behaviour of animations that are
dynamically removed and added from a document with regards to the
events that are generated.

Suppose an animation is in play when it is temporarily removed from
the document. Later, that same animation is re-attached to the
document. In the meantime however, the time of the document (or, more
accurately, the time container) may have changed either through
seeking the document or simply due to the wallclock time that has
elapsed.

When the animation is re-attached it must either catch-up or wind back
to the document time. However, just how this should be done is not, so
far as I know, specified.

Some options include:

1) When the element is removed, all information regarding the
animation's progress is lost. Re-attaching effectively performs a kind
of forwards-seek on the animation.

2) Animation progress is retained and when the element is re-attached
either a forwards or backwards seek is performed as required.

Personally, I think (1) is more intuitive, particularly as the element
may be re-attached to a different time container altogether.

However, regardless of which it is, there is still the question of the
nature of the seek. Generally, when seeking is performed most events
that would otherwise be generated along the way are suppressed.[1] So,
is attaching an element a genuine seek in that sense or should all
events still be generated? My feeling is that they should still be
generated.

Thus for the attached example which I've simplified below:

<svg>
  <script>
    function seek()
    {
      svg.setCurrentTime(11);
      circle.removeChild(animate);
      svg.setCurrentTime(7);
      circle.appendChild(animate);
    }
    document.addEventListener("SVGLoad", seek, true);
  </script>
  <circle ...>
    <animate begin="2s; 6s; 10s" dur="2s" id="animate" .../>
  </circle>
</svg>

My understanding is that we should get:

* 1 x beginEvent as a result of the initial seek to t=11s (as per my
interpretation of [1])
* 2 x beginEvent as a result of re-attaching the animation element
(which will drive the animation through begin times 2s and 6s)

Then after 3s,
* 1 x beginEvent when the third interval begins (at t=10s)

Another issue is whether detaching an animation that is in play should
generate an endEvent. Personally I think it should not since otherwise
a lot of events would be generated on document teardown unless
implementations differentiate between these two situations
(script-based removal and document teardown).

Any thoughts here would be greatly appreciated.

Best regards,

Brian Birtles

[1] http://www.w3.org/TR/SMIL3/smil-timing.html#q114

Received on Friday, 8 October 2010 00:46:23 UTC