You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Frode Vatvedt Fjeld <fr...@cs.uit.no> on 2007/03/26 14:29:44 UTC

Bug in animateTransform

Hi, I believe I have stumpled upon a bug in Batik (present in current
development sources). It is exposed by the following SVG:

<svg version="1.1"
     xmlns="http://www.w3.org/2000/svg"
     xmlns:xlink="http://www.w3.org/1999/xlink"
     viewBox="-100.00 -100.00 500.00 500.00">
<circle r="5.0000" id="button" fill="red" />
<g transform="translate(0,15)">
  <animateTransform attributeName="transform"
                    type="translate"
                    from="0,15" to="0,45"
                    dur="0.4s"
                    fill="freeze"
                    additive="replace"
                    begin="button.click" />
  <circle r="5.0000" fill="blue" />
</g>
</svg>

The idea here is that a click on the circle with ID "button" triggers
the animation of the second circle (within the group). The bug is that
quite often (at more or less random times), the circle's position is
reset to the original position rather than remain at the end of the
animation.


I am unfamiliar with the Batik sources (and Java as such), but I have
looked at the sources, and it appears to me that the problem is in
TimedElement.java, in TimedElement.sampleAt(). Near the end there is
something to do with computing/"sampling" the final value, and it
seems that for some reason this is done by taking the current time (in
the variable t) modulo the animation's duration (in the variable
d). Presumably due to floating point inaccuracies, this modulo
operations sometimes just "overflows" back to just above zero, causing
the effect (position reset) described above.

If I simply add a small constant, such as 0.05, to the duration 'd',
the bug seems to disappear. However I don't expect that this is really
the correct solution. Hopefully someone with a better grasp of Batik
will be able to fix it properly.


Regards,
-- 
Frode Vatvedt Fjeld


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


Re: Bug in animateTransform

Posted by Frode Vatvedt Fjeld <fr...@cs.uit.no>.
I just added this as bug 41947 in ASF Bugzilla.

-- 
Frode Vatvedt Fjeld


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