xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Helder Magalhães <helder.magalh...@gmail.com>
Subject Re: My canvas does not display some changes
Date Sun, 17 Jan 2010 09:43:29 GMT
Hi Dao,


> I take the same code and insteed of setting the visibility on/off, I want a
> smoother rendering.
> I decide to add an animate element on the opacity attribute.

FWIW, I've done experiments with this in the past but ended up using
plain blinking (toggle the "display" property) due to the high
resource consumption (CPU) noticed while doing smooth fade in/out and
also due to lack of interoperability across SVG implementations.
Although regarding the high CPU consumption, Batik Squiggle has a
neat, configurable [1] way to avoid that. :-)


> I do this:
[...]
> anim.setAttributeNS(null,"attributeType","CSS");

Nit: I recall that, in my tests, using CSS opacity was less performant
than straight (XML) opacity. I'm not sure if it matters in Batik,
though... ;-)


> @Override
> public void run() {
> anim.setAttribute("from", "0.5");
> anim.setAttribute("to", "0");
> anim.beginElement();
> mask.setAttribute("opacity", "0");

> With this, I can't the opacity switches directly without the fade away I
> want. When I put the visible.svg and hidden.svg files in squiggle, I have
> the animation running as I want. what's wrong?

I guess what's happening is that you are mixing two things which you
probably didn't intend: CSS and SVG (XML) opacity. Although apparently
the same, they have differences such as the override rules (which
seems to be the cause). Just switch to XML attributes and you probably
are in the good path again. ;-)


> In squiggle, it seems that for example, if I want the opacity from 0 to 0.5,
> it blinks like 0.5, then 0 then smoothly 0.5. How can I do to avoid this?

I'd suggest getting more familiar with SMIL animation [2] [3] before
diving more into this. ;-)


Cheers,
 Helder


[1] In Squiggle, this is available in
"Edit"/"Preferences"/"General"/"Animation rate limiting"
[2] http://www.w3.org/TR/SVG/animate.html
[3] http://www.w3.org/Graphics/SVG/IG/resources/svgprimer.html#SMIL_animations

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


Mime
View raw message