W3C home > Mailing lists > Public > public-fx@w3.org > January to March 2015

[web-animations] Live update to the model issue

From: Сергей Грехов <sgrekhov@unipro.ru>
Date: Thu, 19 Feb 2015 13:17:45 +0600
Message-ID: <f043db633317c2792096225038806d72.squirrel@unipro.ru>
To: public-fx@w3.org
Cc: dom@unipro.ru
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

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