Klaus Reimer wrote: > > Hello, > > I have an application which displays an SVG document in a JSVGCanvas and > I'm adding content to the document during runtime. This works pretty > well but when I add animation nodes to the DOM then they are simply > ignored. The animation nodes which are already present in the DOM when I > pass it to the canvas (with the setURI method) are working fine. > > Is there a special trick I have to perform so animations added during > runtime are actually played? > > -- > Bye, K <http://www.ailis.de/~k/> > [A735 47EC D87B 1F15 C1E9 53D3 AA03 6173 A723 E391] > (Finger [EMAIL PROTECTED] to get public key) > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > >
I've been having this same problem, so I took a look around the W3C's SMIL specification, and it turns out there is a special trick that you have to perform. You see, by default, SMIL animations are timed by their "begin" attribute, and if that attribute is not present, they will begin when the document loads. So, if you want an animation to play as soon as it is added to the document, simply appending the node to the document will not work. You have to tell the animation node when to start. The way to do this is the beginElement() function, which all animation elements have. In Javascript/ECMAScript, you can start an animation like so: document.getElementById(name).beginElement(); It's that simple. I'm not sure how to do it in Java with the Batik APIs, though, because Java's strict typing makes it a little more difficult. You see, beginElement() is a method of the ElementTimeControl interface, not the Element object. I can't help you there; you'll have to figure this out yourself if you need it. Try looking around the Batik Javadocs. Hope this helps ~ Ace -- View this message in context: http://www.nabble.com/Adding-animations-to-the-SVG-DOM-during-runtime-tp13944995p14246331.html Sent from the Batik - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
