function sample(){
p=Math.PI;
m=1;
m1=1;
var timer;
var delay = 100;
mode=1;
var loop = function () {
m=m+1;
if(m>35)m=m-36;
m1=m1+2;
if(m1>35)m1=m1-36;
x=250+250*Math.cos(10*m*p/180);
y=250+250*Math.sin(10*m*p/180);
x1=250+250*Math.cos(10*m1*p/180);
y1=250+250*Math.sin(10*m1*p/180);
if(mode==1)paintx();
if(mode==2)paint();
h=0;
if(Math.random()>0.9)h=h+1;
if(mode==1)h=h+1;
if(h==2)mode=2;
h=0;
if(Math.random()>0.9)h=h+1;
if(mode==2)h=h+1;
if(h==2)mode=1;
clearTimeout(timer);
timer = setTimeout(loop, delay);
}
loop();
}
function paint(){
var sub=new svgpaint();
str="<svg width=\"500\" height=\"500\">";
str=str+sub.line(250,250,x,500-y,5,"red");
str=str+sub.line(250,250,x1,500-y1,5,"blue");
str=str+"</svg>";
$("#memo").html(str);
}
function paintx(){
var sub2=new svgpaint();
str="<svg width=\"500\" height=\"500\">";
str=str+sub2.rect(0,0,500,500,"green");
str=str+"</svg>";
$("#memo").html(str);
}
最終更新:2015年12月07日 12:51