[web-animations] Live update to the model issue

Hi All,

Please see the second non-normative section, containing Example 19, in
5.21. Script execution and live updates to the model
(https://w3c.github.io/web-animations/#script-execution-and-live-updates-to-the-model).

// Set opacity to 0 immediately
elem.animate({ opacity: 0 }, { fill: 'forwards' });
alert(window.getComputedStyle(elem).opacity); // Displays ‘0’

According this example changes should take place immediately. But
according definition of Animatable.animate()
(https://w3c.github.io/web-animations/#dom-animatable-animateeffect-timing)
example above is the same as

var anim = new Animation(elem, { opacity: 0 }, 2000);
elem.ownerDocument.timeline.play(anim);

But player does not play animation immediately, it may wait for source
content. So shouldn't this example be rewritten as the below?

var player = elem.animate({ opacity: 0 }, { fill: 'forwards' });
player.ready.then(function () {
    alert(window.getComputedStyle(elem).opacity); // Displays ‘0’
});

Please also note that there's a type in the example 20 in the same section.
// Set width to 0 immediately  <-- there should be 100 instead of 0
rect.animate({ width: '100px' }, { fill: 'forwards' });
alert(rect.width.animVal.value); // Displays ‘100’

Thank you,
Sergey G. rekhov

Received on Thursday, 19 February 2015 07:20:24 UTC