W3C home > Mailing lists > Public > public-fx@w3.org > April to June 2015

[web-animations] Sampling optimization

From: Glen Huang <curvedmark@gmail.com>
Date: Wed, 15 Apr 2015 14:37:15 +0800
Message-Id: <63580617-0EBD-45E0-A071-7D1A254B5B9D@gmail.com>
To: public-fx@w3.org
If I understand the spec correctly, in the case of keyframe effects, an UA is expected to periodically update all keyframe effects. Upon being requested to update itself, a keyframe effect then queries the animation (who in turn queries the document timeline) to get time fraction and current iteration, and finally apply css properties or dom attributes to the target element accordingly.

This whole process has one premise: the UA needs to periodically update all keyframe effects *unconditionally*. However in reality, the UA, after updating all keyframe effects, can check if any associated animation is still in running play state, if not, it can stop periodically updating keyframe effects all together. Only when an associated animation's play state become running (e.g., because a paused animation is played by a script), the UA then restart periodically updating keyframe effects. I wonder if this is how UAs will really implement it? After all, if all animations are currently paused (and only play when user clicks a button for example), keep periodically updating keyframe effects to reapply the same css properties or dom attributes over and over again is a waste of resource.

This is at least how the web-animations polyfill work: when no animation is in running play state, it stops calling `requestAnimationFrame`.

Could the spec be specified this way? So it's easier for everybody to correctly implement this optimization (e.g., when to stop and restart the periodical updating)?
Received on Wednesday, 15 April 2015 06:38:00 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:49:54 UTC