var a=new Array();
var mode;
function sample(){
mode=1;
a[1]=new Array();
a[2]=new Array();
a[1][1]=0.5;
a[1][2]=0.5;
a[2][1]=0.33;
a[2][2]=0.67;
var timer;
var delay = 1000;
var loop = function () {
p1=a[mode][1];
p2=a[mode][2];
mode=2;
if(Math.random()<p1)mode=1;
paint();
clearTimeout(timer);
timer = setTimeout(loop, delay);
}
loop();
paint();
}
function paint(){
var sub=new svgpaint();
str="<svg width=\"700\" height=\"700\">";
if(mode==1)str=str+sub.rect(30,100,30,30,"blue");
if(mode==2)str=str+sub.rect(30,100,30,30,"red");
str=str+"</svg>";
$("#memo").html(str);
}
最終更新:2016年04月19日 22:42