xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dao <dao.ho...@gmail.com>
Subject Re: animate an element
Date Tue, 12 Jan 2010 11:06:53 GMT
you mean that I have to set all the attributes in the same runnable? of the
updaterunnablequeue?

On Tue, Jan 12, 2010 at 11:56 AM, <thomas.deweese@kodak.com> wrote:

> Hi Dao,
>
> dao <dao.hodac@gmail.com> wrote on 01/11/2010 06:22:58 PM:
>
> > Actually, I created the anim elements with the namespace
> > "http://www.w3.org/2000/svg".
> > It is in fact null... how can I know which element belongs to which
> namespace?
>
>    Attributes that don't have a prefix (i.e. xlink:) should
> be in the null namespace.  Attributes that have a prefix should be
> in the namespace associated with that prefix.  In SVG this means that
> essentially only the xlink attributes need namespaces.
>
> > But when I do this
> > public void setVisible(final Element elt, boolean b) {
> > final Element mask = elt2mask.get(elt);
> > if (mask == null)
> > return;
> > Element anim = (Element) mask.getElementsByTagNameNS(null,
> "animate").item(0);
> > String animId = anim.getAttribute("id");
> > if (b) {
> > SvgRepaintEngine.getInstance().push(new
> AttributeUpdateTask(mask.getAttribute(
> > "id"),"opacity", "1"));
> > SvgRepaintEngine.getInstance().push(new AttributeUpdateTask(animId,
> "from",
> > "0"));
> > SvgRepaintEngine.getInstance().push(new AttributeUpdateTask(animId, "to",
> "1"
> > ));
> > } else {
> > SvgRepaintEngine.getInstance().push(new
> AttributeUpdateTask(mask.getAttribute(
> > "id"),"opacity", "0"));
> > SvgRepaintEngine.getInstance().push(new AttributeUpdateTask(animId,
> "from",
> > "1"));
> > SvgRepaintEngine.getInstance().push(new AttributeUpdateTask(animId, "to",
> "0"
> > ));
> > }
> >
> > the animation does not perform, and the opacity changes immediately
> > (I tried to remove the first change)
>
>    I think this is because you haven't started the animation, probably by
> calling 'beginElement()' in your case.
>
> > Note that the SvgRepaintEngine only calls the invokeLater of the
> > update manager to make a setAttribute
>
>    You _really_ should have a way to bundle those changes together,
> you could get strange results if a repaint started in between some
> of those set attribute calls.
>
> > On Sat, Jan 9, 2010 at 2:58 PM, <thomas.deweese@kodak.com> wrote:
> > Hi Dao,
> >
> > dao <dao.hodac@gmail.com> wrote on 01/06/2010 09:17:33 AM:
> >
> >
> > > hello, I am running into a problem while attempting to animate an
> object.
> > >
> > > I create an animation object using batik and I add this to my
> > > ALWAYS_DYNAMIC canvas. The dump of the XML is like that after the
> append:
> >
> >     What do you get if you call:
> >         String an = animateElem.getAttributeNS(null, "attributeName");
> >
> >     I see that in your 'dump' it looks OK, but the dump can easly not
> > represent the details of the DOM in memory.
> >
> >     Can you post the code you use to create the animate element?
> >
> > > I get this exception. What's wrong with me?
> >
> > > org.apache.batik.bridge.BridgeException: file:/C:/Users/to81028/
> > > runtime-EclipseApplication/aet/image/toto.svg:0
> > > The attribute "" of the element <g> is not animatable
> > >     at
>
> >    This means that in the animation bridge the getAttributeNS call
> > above is returning either null or "" (not entirely sure which).
> > Are you perhaps appending the element before setting all of it's
> > attributes?
> >
> > > org.apache.batik.bridge.SVGAnimationElementBridge.initializeAnimation
> > > (SVGAnimationElementBridge.java:213)
> > >     at
> > > org.apache.batik.bridge.SVGAnimationElementBridge.handleElement
> > > (SVGAnimationElementBridge.java:154)
> > >     at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode
> > > (GVTBuilder.java:198)
> > >     at org.apache.batik.bridge.GVTBuilder.buildComposite
> > (GVTBuilder.java:171)
> > >     at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode
> > > (GVTBuilder.java:219)
> > > ...
> > >
> > > --
> > > Dao Hodac
> >
> >
> >
> > --
> > Dao Hodac
>



-- 
Dao Hodac

Mime
View raw message