RE: Clarification of "baseVal"

Antoine,
'baseVal' should always be in sync with the current state of
getAttributeNS() and setAttributeNS(). If you do a setAttributeNS(null,
'width', whatever), then 'baseVal' should be updated immediately.
(Furthermore, any additive animation values should instantly change to
be relative to the new 'baseVal'.)

The notion of a "base value" is discussed at
http://www.w3.org/TR/smil-animation/#AnimationSandwichModel, which is
referenced normatively by the SVG 1.0 specification. The 'baseVal'
property in the SVG DOM represents what the SMIL Animation specification
refers to as the "base value".

I have attempted to comment on the details below as best I can:

> -----Original Message-----
> From: www-svg-request@w3.org [mailto:www-svg-request@w3.org] On Behalf
Of
> Antoine Quint
> Sent: Monday, October 07, 2002 7:56 AM
> To: www-svg@w3.org
> Subject: Clarification of "baseVal"
> 
> 
> Hi there,
> 
> 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

I agree with the above two conclusions, except it is animVal, not
animatedVal.

> rect.setAttributeNS(null, 'width', 500);
> width = rect.width.baseVal; // 100

The 'baseVal' should now be 500, not 100.

> 
> How about at 2s (animation over and frozen)?
> 
> var width = rect.width.baseVal; // 100

If all of this is consecutively executed JavaScript, then baseVal is now
500 because of the setAttributeNS() invocation above.

> width = rect.width.animatedVal; // 200

Yes, except it is animVal, not animatedVal.

Jon Ferraiolo
SVG 1.0 Editor

> 
> Thanks for advice,
> 
> Antoine
> 

Received on Monday, 7 October 2002 12:53:49 UTC