xmlgraphics-batik-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cameron McCormack <cam-batik-...@aka.mcc.id.au>
Subject Re: Animated paths
Date Sat, 19 Jun 2004 00:20:27 GMT
Hi Piyush.

Piyush Rai:
> My problems is:
> Given an arbitrary SVG file containing several path elements, I need
> to show all these paths in the order in which they appear in the file.
> However, the paths need to be shown in an incremental manner(they
> should appear to be "moving", as they are drawn). I guess, I'll
> have to access the coordinates from path data "d" somehow and show
> one point at a time using a function like "setTimeout("advance()",
> delay)".
>
> Someone please tell me whether there are some functions which allow
> me to access path data(and manipulate it)? Going through the DOM
> documentation would really be troublesome :-(

Yes.  If you have a reference to an SVGPathElement you can call the
method getPathSegList which will return you an SVGPathSegList object.
See http://www.w3.org/TR/SVG11/paths.html#InterfaceSVGPathSegList .

> Also, since there are more than one paths in the SVG file, how can I
> get the list of all these paths so that I can show them one by one in
> in the batik viewer using the above method?

You could use document.getElementsByTagNameNS(svgns, "path") which will
return a NodeList object of all the path elements in the document, in
document order.

Cameron

-- 
Cameron McCormack
|  Web: http://mcc.id.au/
|  ICQ: 26955922

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org


Mime
View raw message