while(j < lengMass) { window.setInterval(function() { s.lineTo(massCoord[i][j], massCoord[i][j+1]); s.stroke(); },100); j+=2; }