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><!-- By Sam Herbert (@sherb), for everyone. M=
ore @ <a href=3D"http://goo.gl/7AJzbL">http://goo.gl/7AJzbL</a> --><br>&=
lt;svg width=3D"55" height=3D"80" viewBox=3D"0 0 5=
5 80" xmlns=3D"<a href=3D"http://www.w3.org/2000/svg">http://www.=
w3.org/2000/svg</a>" fill=3D"#FFF"><br>=C2=A0 =C2=A0 <=
g transform=3D"matrix(1 0 0 -1 0 80)"><br>=C2=A0 =C2=A0 =C2=A0=
=C2=A0 <rect width=3D"10" height=3D"20" rx=3D"=
3"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <animate attrib=
uteName=3D"height"<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0begin=3D"0s" dur=3D"4.3s"<br>=C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0values=3D"20;4=
5;57;80;64;32;66;45;64;23;66;13;64;56;34;34;2;23;76;79;20" calcMode=3D=
"linear"<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0repeatCount=3D"indefinite" /><br>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 </rect><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 <rect x=3D"=
15" width=3D"10" height=3D"80" rx=3D"3"&=
gt;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <animate attributeName=
=3D"height"<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0begin=3D"0s" dur=3D"2s"<br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0values=3D"80;55;33;5;7=
5;23;73;33;12;14;60;80" calcMode=3D"linear"<br>=C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0repeatCount=3D"indefi=
nite" /><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </rect><br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 <rect x=3D"30" width=3D"10" height=
=3D"50" rx=3D"3"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 <animate attributeName=3D"height"<br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0begin=3D"0s" dur=
=3D"1.4s"<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0values=3D"50;34;78;23;56;23;34;76;80;54;21;50" calcMode=
=3D"linear"<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0repeatCount=3D"indefinite" /><br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 </rect><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 <rect x=3D&qu=
ot;45" width=3D"10" height=3D"30" rx=3D"3&quo=
t;><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <animate attributeNa=
me=3D"height"<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0begin=3D"0s" dur=3D"2s"<br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0values=3D"30;45;13;80;=
56;72;45;76;34;23;67;30" calcMode=3D"linear"<br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0repeatCount=3D"ind=
efinite" /><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </rect><br>=C2=A0 =
=C2=A0 </g><br></svg></div><div><br></div><div>How do I get inf=
ormation on the animation "attached" 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:"Menlo"=
;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'm no=
t seeing anything on the nodes that would "connect" 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:"Me=
nlo";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:"Menlo";font-size:10.5pt"><span style=3D"f=
ont-family:arial,sans-serif">Kirill<br></span></pre></div></div>
--0000000000006c85ad0590184bab--