Re: SVGStopElement offset

Hello Niklas, www-svg,

You wrote
http://lists.w3.org/Archives/Public/www-svg/2002Jul/0003.html

> I've been looking into the SVGStopElement in the SVG 1.0/1.1 DOM and
> got a question.
> 
> The offset attribute can hold either a number or a percentage, but
> in the DOM interface the offset can only hold a animated number. How
> am I supposed to save/get the percentage value?
> 
> Probably mis-understanding something :-)

Dean replied
http://lists.w3.org/Archives/Public/www-svg/2002Jul/0007.html

> Maybe I'm misunderstanding your question, but you could always use
> getAttribute to see exactly how it was set in the document
> (percentage or number).

This deals with the part about finding the originaly specified value.

> However, if you want the animated value, then you have to use
> the SVG DOM, thus animated number (which only gives you a float).

This gives you the instantaneous value, which might be animated, but
always gives it as a float.

> Looks like you'll have to multiply by 100 to get the percentage
> value through the SVG DOM. We'll quickly check this within the
> WG since it seems a little weird, but I don't think there is
> much we can do with it (i.e. we couldn't make it an SVGLength).
> By the way, we're about to carefully check all the <percentage>
> and <length> attributes in the SVG specification (for another
> reason).

The only missing piece from this explanation was that, if you wanted
to capture and serialize the animated values at some point in time,
and if you also wanted to express them in percent form, they yes you
would need to multiply them by 100 and append a percent sign before
inserting this string as the attribute value.

Hopefully that answers all your questions. All the information you
want is available both to be read and to be written, but not all on
this one SVG DOM interface. The XML Core dom fills in the rest (more
precisely, the SVG DOM provides additional information, such as the
animated value, that the XML DOM Core does not).


-- 
 Chris                          mailto:chris@w3.org

Received on Wednesday, 13 November 2002 03:48:44 UTC