Hi Cui.

Cui Jian:
> I am trying to do something with svg's animation features and having the  
> following problem (which is illustrated in the attached program)
> a ball's color is made to change from red to blue during one second and  
> repeats all over.
> But I want to stop the color-changing but pressing the button "stop" and  
> also start the color-chaning again by pressing the button "blink" by  
> setting the repeatcount attribute using the following the codes:
>                     
> animateColorE.setAttribute(SVGConstants.SVG_REPEAT_COUNT_ATTRIBUTE, "0");
> and
>                     
> animateColorE.setAttribute(SVGConstants.SVG_REPEAT_COUNT_ATTRIBUTE,  
> "indefinite");
> But it just doesn't work...

Modifying the attributes of an animation element while it is in the
document will not change the animation.  This is half bug, half
underdefined-ness in the SVG specification.  What will work, though, is
removing the animation element from the document to stop it, and
re-inserting it when you want to start it again.

Alternatively, you could use the beginElement() and endElement() methods
on animateColorE (you’ll need to cast it to ElementTimeControl to get
those methods).  That will start or stop the animation.  (Technically,
it’s like adding an entry to the begin="" or end="" attribute with the
current time.)

-- 
Cameron McCormack ≝ http://mcc.id.au/

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to