// update text showing slider value
function outputRound(v) {
document.querySelector('#roundno').value = v;
curRoundIndex=v;
moveBublesToIndex(curRoundIndex);
}
Kjernen i koden som drar animasjonen er slik:
_move
function moveBublesToIndex(index){
// just to make sure
if(index>=curRoundCount)
return;
var blist=svgElt.querySelectorAll(".bubble");
var Offset=xOffset;
for(var i=0; i< blist.length; i++){
var rlist=curSeason.teamList[i].roundlist;
blist[i].setAttribute("transform",
"translate("+Offset+","+curPointStep*rlist[index]+")");
var L=blist[i].querySelector("line")
L.setAttribute("y2",-curPointStep*rlist[index]);
Offset+=xOffset;
updatePTextInBubbles(index);
}
}