Hi Nicky,
> I want to have an object moved along a path using the animateMotion element. > This works pretty well, but if I extend the path during animation the > modification is not recognized and the object keeps on moving the original > path. As far as I know, animating paths in SVG requires that the number of segments is kept during the animation [1] (at least in SVG Tiny 1.2). So I imagine that Batik's animateMotion implementation can be somehow tied to this concept...? You may animate the path taking this into consideration, though. ;-) > Here's the code: I'd suggest only pasting the relevant code snippets inline and attaching the full code (or posting a link to it and attach it online somewhere) in order to ease on reading/replying. ;-) > I actually got it working by removing the animation element from the doc and > in turn append a copy of it: Yeah, that would workaround the behavior above, as the new path would be then used for the animateMotion. > Another next problem would be to determine the prosition of the moving > object and to detect a collition with an other element. For detecting position you have several DOM methods (for computing distance along a path [2], getting an element's bounding box - getBBox [3], etc.). Also, as far as I know there's no native collision detection in SVG, although you may compute it by comparing bounding box limits (somehow fuzzy) and/or intersections points [4] (should be more precise but also computationally more expensive). > Thanks for your help. For general questions on SVG (not specific to Batik), I'd also recommend keeping an eye/posting into SVG Developers [5] mailing list. Please avoid cross-posting, though, as many are watching both lists. ;-) Hope this helps, Helder [1] http://www.w3.org/TR/SVGTiny12/paths.html#PathDataAnimation [2] http://www.w3.org/TR/SVG11/paths.html#DistanceAlongAPath [3] http://www.w3.org/TR/SVG11/ecmascript-binding.html [4] http://ajaxian.com/archives/intersections-and-svg-objects [5] http://groups.yahoo.com/group/svg-developers/ --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
