- From: Thierry Kormann <tkormann@ilog.fr>
- Date: Mon, 7 Oct 2002 18:36:21 +0200
- To: "Antoine Quint" <antoine@graougraou.com>, <www-svg@w3.org>
> I need a little bit of clarification as to what the core difference is > between baseVal and the core DOM value of an attribute. Say I have the > following example: > > <rect width="100" height="100"> > <animate attributeName="width" dur="2s" to="200" fill="freeze" /> > </rect> > > Here is a bit of DOM code executed at 1s within the document timeline, > are my assumptions correct (I am not aware of any implementation to > test this): > > var width = rect.width.baseVal; // 100 > width = rect.width.animatedVal; // 150 > rect.setAttributeNS(null, 'width', 500); > width = rect.width.baseVal; // 100 width = rect.width.baseVal; // 500 ! > How about at 2s (animation over and frozen)? > > var width = rect.width.baseVal; // 100 > width = rect.width.animatedVal; // 200 var width = rect.width.baseVal; // 500 (due to the previous setAttributeNS --- baseVal represents the same value as its coresponding attribute. animatedVal is the value that results from the animation (always override the value from the DOM). In addition, Animated values are live so you can do something like (keeping a reference on the SVGAnimatedLength): var length = rect.width; alert(length.width); // shows 100 for instance rect.setAttribute("width", 200); alert(length.baseVal); // now shows 200 Regards, Thierry.
Received on Monday, 7 October 2002 12:36:30 UTC