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

[web-animations] Confusing variable names in Animatable.animate() examples

From: Сергей Грехов <sgrekhov@unipro.ru>
Date: Thu, 5 Mar 2015 12:35:35 +0600
Message-ID: <3c22585e253df0be7c8e12c04b1d13c6.squirrel@unipro.ru>
To: public-fx@w3.org
Cc: dom@unipro.ru
Hi all,

Animatable.animate()
(http://w3c.github.io/web-animations/#the-animatable-interface) contains
the following examples:

EXAMPLE 15
var anim = elem.animate({ opacity: 0 }, 2000);

is equivalent to:

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

In these examples variable anim is used for AnimationPlayer in Example 15
and for Animation in Example 16. This may be confusing. It's better to
rewrite these examples in the following way:

EXAMPLE 15
var player = elem.animate({ opacity: 0 }, 2000);

is equivalent to:

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

Thank you,
Sergey G. Grekhov
Received on Thursday, 5 March 2015 06:38:48 UTC

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