Programmatic access to animation information

Kirill Grouchnikov <[email protected]> Wed, 14 Aug 2019 14:54:51 -0400
Newsgroups gmane.text.xml.batik.user
Message-ID <CAMRG33Z1rvWf6Lr1zSwMkg0iHxG6ktBG78K7QksZxvXEF7DALQ@mail.gmail.com>
--0000000000006c85ad0590184bab
Content-Type: text/plain; charset="UTF-8"

For a simple SVG content with animations such as this:

<!-- By Sam Herbert (@sherb), for everyone. More @ http://goo.gl/7AJzbL -->
<svg width="55" height="80" viewBox="0 0 55 80" xmlns="
http://www.w3.org/2000/svg" fill="#FFF">
    <g transform="matrix(1 0 0 -1 0 80)">
        <rect width="10" height="20" rx="3">
            <animate attributeName="height"
                 begin="0s" dur="4.3s"

 values="20;45;57;80;64;32;66;45;64;23;66;13;64;56;34;34;2;23;76;79;20"
calcMode="linear"
                 repeatCount="indefinite" />
        </rect>
        <rect x="15" width="10" height="80" rx="3">
            <animate attributeName="height"
                 begin="0s" dur="2s"
                 values="80;55;33;5;75;23;73;33;12;14;60;80"
calcMode="linear"
                 repeatCount="indefinite" />
        </rect>
        <rect x="30" width="10" height="50" rx="3">
            <animate attributeName="height"
                 begin="0s" dur="1.4s"
                 values="50;34;78;23;56;23;34;76;80;54;21;50"
calcMode="linear"
                 repeatCount="indefinite" />
        </rect>
        <rect x="45" width="10" height="30" rx="3">
            <animate attributeName="height"
                 begin="0s" dur="2s"
                 values="30;45;13;80;56;72;45;76;34;23;67;30"
calcMode="linear"
                 repeatCount="indefinite" />
        </rect>
    </g>
</svg>

How do I get information on the animation "attached" to each corresponding
node in the tree returned by GVTBuilder.build?

UserAgentAdapter ua = new UserAgentAdapter();
DocumentLoader loader = new DocumentLoader(ua);
batikBridgeContext = new BridgeContext(ua, loader);
batikBridgeContext.setDynamicState(BridgeContext.DYNAMIC);
ua.setBridgeContext(batikBridgeContext);
GVTBuilder builder = new GVTBuilder();
Document svgDoc = loader.loadDocument(someURI);
GraphicsNode gvtRoot = builder.build(batikBridgeContext, svgDoc);

I'm not seeing anything on the nodes that would "connect" them to any
of the animation API classes exposed by Batik

Thanks

Kirill

--0000000000006c85ad0590184bab
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>For a simple SVG content with animations such as this=
:</div><div><br></div><div>&lt;!-- By Sam Herbert (@sherb), for everyone. M=
ore @ <a href=3D"http://goo.gl/7AJzbL">http://goo.gl/7AJzbL</a> --&gt;<br>&=
lt;svg width=3D&quot;55&quot; height=3D&quot;80&quot; viewBox=3D&quot;0 0 5=
5 80&quot; xmlns=3D&quot;<a href=3D"http://www.w3.org/2000/svg">http://www.=
w3.org/2000/svg</a>&quot; fill=3D&quot;#FFF&quot;&gt;<br>=C2=A0 =C2=A0 &lt;=
g transform=3D&quot;matrix(1 0 0 -1 0 80)&quot;&gt;<br>=C2=A0 =C2=A0 =C2=A0=
 =C2=A0 &lt;rect width=3D&quot;10&quot; height=3D&quot;20&quot; rx=3D&quot;=
3&quot;&gt;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &lt;animate attrib=
uteName=3D&quot;height&quot;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0begin=3D&quot;0s&quot; dur=3D&quot;4.3s&quot;<br>=C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0values=3D&quot;20;4=
5;57;80;64;32;66;45;64;23;66;13;64;56;34;34;2;23;76;79;20&quot; calcMode=3D=
&quot;linear&quot;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0repeatCount=3D&quot;indefinite&quot; /&gt;<br>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 &lt;/rect&gt;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 &lt;rect x=3D&quot;=
15&quot; width=3D&quot;10&quot; height=3D&quot;80&quot; rx=3D&quot;3&quot;&=
gt;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &lt;animate attributeName=
=3D&quot;height&quot;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0begin=3D&quot;0s&quot; dur=3D&quot;2s&quot;<br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0values=3D&quot;80;55;33;5;7=
5;23;73;33;12;14;60;80&quot; calcMode=3D&quot;linear&quot;<br>=C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0repeatCount=3D&quot;indefi=
nite&quot; /&gt;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 &lt;/rect&gt;<br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 &lt;rect x=3D&quot;30&quot; width=3D&quot;10&quot; height=
=3D&quot;50&quot; rx=3D&quot;3&quot;&gt;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 &lt;animate attributeName=3D&quot;height&quot;<br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0begin=3D&quot;0s&quot; dur=
=3D&quot;1.4s&quot;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0values=3D&quot;50;34;78;23;56;23;34;76;80;54;21;50&quot; calcMode=
=3D&quot;linear&quot;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0repeatCount=3D&quot;indefinite&quot; /&gt;<br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 &lt;/rect&gt;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 &lt;rect x=3D&qu=
ot;45&quot; width=3D&quot;10&quot; height=3D&quot;30&quot; rx=3D&quot;3&quo=
t;&gt;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &lt;animate attributeNa=
me=3D&quot;height&quot;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0begin=3D&quot;0s&quot; dur=3D&quot;2s&quot;<br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0values=3D&quot;30;45;13;80;=
56;72;45;76;34;23;67;30&quot; calcMode=3D&quot;linear&quot;<br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0repeatCount=3D&quot;ind=
efinite&quot; /&gt;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 &lt;/rect&gt;<br>=C2=A0 =
=C2=A0 &lt;/g&gt;<br>&lt;/svg&gt;</div><div><br></div><div>How do I get inf=
ormation on the animation &quot;attached&quot; to each corresponding node i=
n the tree returned by GVTBuilder.build? <br></div><div><pre style=3D"backg=
round-color:rgb(255,255,255);color:rgb(0,0,0);font-family:&quot;Menlo&quot;=
;font-size:10.5pt">UserAgentAdapter ua =3D <span style=3D"color:rgb(0,0,128=
);font-weight:bold">new </span>UserAgentAdapter();<br>DocumentLoader loader=
 =3D <span style=3D"color:rgb(0,0,128);font-weight:bold">new </span>Documen=
tLoader(ua);<br><span style=3D"color:rgb(102,14,122);font-weight:bold">bati=
kBridgeContext </span>=3D <span style=3D"color:rgb(0,0,128);font-weight:bol=
d">new </span>BridgeContext(ua, loader);<br><span style=3D"color:rgb(102,14=
,122);font-weight:bold">batikBridgeContext</span>.setDynamicState(BridgeCon=
text.<span style=3D"color:rgb(102,14,122);font-weight:bold;font-style:itali=
c">DYNAMIC</span>);<br>ua.setBridgeContext(<span style=3D"color:rgb(102,14,=
122);font-weight:bold">batikBridgeContext</span>);<br>GVTBuilder builder =
=3D <span style=3D"color:rgb(0,0,128);font-weight:bold">new </span>GVTBuild=
er();<br>Document svgDoc =3D loader.loadDocument(<span style=3D"color:rgb(0=
,0,128);font-weight:bold">someURI</span><span style=3D"color:rgb(102,14,122=
);font-weight:bold"></span>);<br>GraphicsNode gvtRoot =3D builder.build(<sp=
an style=3D"color:rgb(102,14,122);font-weight:bold">batikBridgeContext</spa=
n>, svgDoc);<br><br><span style=3D"font-family:arial,sans-serif">I&#39;m no=
t seeing anything on the nodes that would &quot;connect&quot; them to any o=
f the animation API classes exposed by Batik<br><br></span></pre><pre style=
=3D"background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:&quot;Me=
nlo&quot;;font-size:10.5pt"><span style=3D"font-family:arial,sans-serif">Th=
anks<br></span></pre><pre style=3D"background-color:rgb(255,255,255);color:=
rgb(0,0,0);font-family:&quot;Menlo&quot;;font-size:10.5pt"><span style=3D"f=
ont-family:arial,sans-serif">Kirill<br></span></pre></div></div>

--0000000000006c85ad0590184bab--