function sample(){ pi=Math.PI; n=0; var timer; var delay = 100; var loop = function () { n=n+10; paint(); clearTimeout(timer); timer = setTimeout(loop, delay); } loop(); } function paint(){ var sub=new svgpaint(); str="<svg width=\"500\" height=\"500\">"; for(s=1;s<501;s++){ y1=200*Math.cos(pi*(n+s)/180); y2=200*Math.cos(pi*(n+s+1)/180); str=str+sub.line(s,250-y1,s+1,250-y2,2,"black"); } str=str+"</svg>"; $("#memo").html(str); }