You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Oliver Brook <ol...@gmx.de> on 2008/02/13 15:42:33 UTC

Control of animation playback in a JSVGCanvas

Hello everybody,

I'm creating a small drawing and (hopefully) animation tool using  
Batik. I'd like to know whether it is possible to get control of the  
playback of an animation in a JSVGCanvas. I've tried using the  
following:

SVGOMSVGElement.pauseAnimations();
SVGOMSVGElement.unPauseAnimations();
SVGOMSVGElement.setDocumentTime();

This kind of works, but the canvas is not updated correctly when I set  
the document time somewhere between the "begin" and "duration" times  
of an animation element. Is there a correct way to get the JSVGCanvas  
to redraw an animation at a specific time and have it render the  
'between' stages of an animation element properly?

Any advice would be greatly appreciated.

Oliver

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


Re: Control of animation playback in a JSVGCanvas

Posted by Oliver Brook <ol...@gmx.de>.
Hi Tonny,

Thanks for your reply. I tried using the SVGAnimationEngine class  
instead but am still having the same problem. The animation can be  
paused and played at a given time, but the stages in between animation  
instructions are not displayed. Perhaps I'm not being clear enough.

I have an SVG document with the following element:

<animateTransform attributeName="transform" type="scale" from="1"  
to="2" begin="1s" dur="2s" fill="freeze" additive="sum"/>

If I set the time somewhere between 1s and 3s using the  
SVGAnimationEngine then I can't see the in-between stages of the  
animation. I see the element with scale set to either 1 or 2 and  
nowhere in between.

Has anybody encountered this before and know of a fix for the problem?

Oliver

On 14 Feb 2008, at 04:02, Tonny Kohar wrote:

> Hi,
>
> On Feb 13, 2008 9:42 PM, Oliver Brook <ol...@gmx.de> wrote:
>> Hello everybody,
>>
>> I'm creating a small drawing and (hopefully) animation tool using
>> Batik. I'd like to know whether it is possible to get control of the
>> playback of an animation in a JSVGCanvas. I've tried using the
>> following:
>>
>> SVGOMSVGElement.pauseAnimations();
>> SVGOMSVGElement.unPauseAnimations();
>> SVGOMSVGElement.setDocumentTime();
>>
>> This kind of works, but the canvas is not updated correctly when I  
>> set
>> the document time somewhere between the "begin" and "duration" times
>> of an animation element. Is there a correct way to get the JSVGCanvas
>> to redraw an animation at a specific time and have it render the
>> 'between' stages of an animation element properly?
>>
>> Any advice would be greatly appreciated.
>>
>
> Did you try to use SVGAnimationEngine class (supplied with Batik)  
> instead ?
>
> You can get the SVGAnimationEngine from the BridgeContext eg:
> SVGAnimationEngine animEng =  bridgeContext.getAnimationEngine()
>
> You can do a lot things with this SVGAnimationEngine
> eg:
> animEng.start(millis);
> animEngine.pause();
> animEng.setCurrentTime(value);
> etc
>
> On our *simple animation test, this provide smooth and instant
> redraw/refresh of SVG animation.
>
> Note: I do not know whether this approach (SVGAnimationEngine) or your
> approach, is the correct way, and which one should provide better svg
> animation controller.
>
> Cheers
> Tonny Kohar
> -- 
> Sketsa SVG Editor
> imagine, design, create ...
> http://www.kiyut.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


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


Re: Control of animation playback in a JSVGCanvas

Posted by Tonny Kohar <to...@gmail.com>.
Hi,

On Feb 13, 2008 9:42 PM, Oliver Brook <ol...@gmx.de> wrote:
> Hello everybody,
>
> I'm creating a small drawing and (hopefully) animation tool using
> Batik. I'd like to know whether it is possible to get control of the
> playback of an animation in a JSVGCanvas. I've tried using the
> following:
>
> SVGOMSVGElement.pauseAnimations();
> SVGOMSVGElement.unPauseAnimations();
> SVGOMSVGElement.setDocumentTime();
>
> This kind of works, but the canvas is not updated correctly when I set
> the document time somewhere between the "begin" and "duration" times
> of an animation element. Is there a correct way to get the JSVGCanvas
> to redraw an animation at a specific time and have it render the
> 'between' stages of an animation element properly?
>
> Any advice would be greatly appreciated.
>

Did you try to use SVGAnimationEngine class (supplied with Batik) instead ?

You can get the SVGAnimationEngine from the BridgeContext eg:
SVGAnimationEngine animEng =  bridgeContext.getAnimationEngine()

You can do a lot things with this SVGAnimationEngine
eg:
animEng.start(millis);
animEngine.pause();
animEng.setCurrentTime(value);
etc

On our *simple animation test, this provide smooth and instant
redraw/refresh of SVG animation.

Note: I do not know whether this approach (SVGAnimationEngine) or your
approach, is the correct way, and which one should provide better svg
animation controller.

Cheers
Tonny Kohar
-- 
Sketsa SVG Editor
imagine, design, create ...
http://www.kiyut.com

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