Events when adding and removing animation elements in play
Brian Birtles <[email protected]> Fri, 8 Oct 2010 09:45:51 +0900
| Newsgroups | gmane.comp.web.smil |
|---|---|
| Message-ID | <[email protected]> |
--00c09f8e5be517fcc10492105518
Content-Type: text/plain; charset=ISO-8859-1
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
--00c09f8e5be517fcc10492105518
Content-Type: image/svg+xml; name="add-remove.svg"
Content-Disposition: attachment; filename="add-remove.svg"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_gf0bwtwu0
PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4gDQo8c3ZnIHhtbG5zPSJodHRw
Oi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+DQogIDxzY3JpcHQgdHlwZT0iYXBwbGljYXRpb24vZWNt
YXNjcmlwdCI+DQogICAgZnVuY3Rpb24gc2VlaygpDQogICAgew0KICAgICAgdmFyIHN2ZyA9IGRv
Y3VtZW50LmRvY3VtZW50RWxlbWVudDsNCiAgICAgIHZhciBhbmltYXRlID0gZG9jdW1lbnQuZ2V0
RWxlbWVudEJ5SWQoJ2FuaW1hdGUnKTsNCiAgICAgIHZhciBjaXJjbGUgPSBhbmltYXRlLnBhcmVu
dE5vZGU7DQogICAgICBhbmltYXRlLmFkZEV2ZW50TGlzdGVuZXIoImJlZ2luRXZlbnQiLA0KICAg
ICAgICBmdW5jdGlvbigpe3dyaXRlTGluZSgiYmVnaW5FdmVudCIpfSwgZmFsc2UpOw0KDQogICAg
ICBzdmcuc2V0Q3VycmVudFRpbWUoMTEpOyAvLyBHZW5lcmF0ZXMgb25lIGJlZ2luRXZlbnQNCiAg
ICAgIGNpcmNsZS5yZW1vdmVDaGlsZChhbmltYXRlKTsNCiAgICAgIHN2Zy5zZXRDdXJyZW50VGlt
ZSg3KTsNCiAgICAgIGNpcmNsZS5hcHBlbmRDaGlsZChhbmltYXRlKTsNCiAgICB9DQogICAgZnVu
Y3Rpb24gd3JpdGVMaW5lKHN0cikgew0KICAgICAgY29uc3Qgc3ZnbnMgPSAiaHR0cDovL3d3dy53
My5vcmcvMjAwMC9zdmciOw0KICAgICAgdmFyIHRzcGFuID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVu
dE5TKHN2Z25zLCAndHNwYW4nKTsNCiAgICAgIHRzcGFuLmFwcGVuZENoaWxkK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