1 <svg xmlns=
"http://www.w3.org/2000/svg"
2 xmlns:
xlink=
"http://www.w3.org/1999/xlink"
3 xmlns:
xhtml=
"http://www.w3.org/1999/xhtml">
12 document.getElementById(
"A").textContent = '|A|';
13 document.getElementById(
"B").textContent = 'B';
21 document.getElementById(
"A").textContent = 'A';
22 document.getElementById(
"B").textContent = '|B|';
27 var intervalId = null;
29 function startAnimation() {
30 if (intervalId == null) {
31 intervalId = setInterval(animationStep,
20);
35 function animationStep() {
36 if (Math.abs(stateIndex - currentTarget) <
.001) {
37 clearInterval(intervalId);
42 if (stateIndex < currentTarget) {
43 stateIndex +=
1 /
128;
45 stateIndex -=
1 /
128;
48 var elt = document.getElementById(
"targetGroup");
50 var transform =
"translate(" + (
100 * stateIndex) +
"," + (
100 * stateIndex) +
") rotate(" + (
405 * stateIndex) +
",100,250) scale(" + (
1 + stateIndex) +
")" ;
51 var opacity =
1 -
.75 * stateIndex;
53 elt.setAttribute(
"opacity", opacity);
54 elt.setAttribute(
"transform", transform);
61 <text id=
"A" x=
"0" y=
"32" fill=
"red" font-size=
"32" onclick=
"stateA()">|A|
</text>
62 <text id=
"B" x=
"60" y=
"32" fill=
"blue" font-size=
"32" onclick=
"stateB()">B
</text>
63 <text x=
"0" y=
"642" fill=
"black" font-size=
"32">Click B and then A above.
</text>
64 <text x=
"0" y=
"674" fill=
"black" font-size=
"32">The animation should have no trails or clipping.
</text>
66 <circle fill=
"pink" cx=
"300" cy=
"300" stroke=
"lightblue" stroke-width=
"40" r=
"300" />
69 <rect fill=
"yellow" stroke=
"#000000" stroke-width=
"2" x=
"60" y=
"60" width=
"170" height=
"170" />
71 <image id=
"targetGroup" x=
"60" y=
"60" width=
"170" height=
"170" xlink:
href=
"resources/3dolph.gif" />