アットウィキロゴ

ppp98mod

var mode;
var t;
function sample(){
 
mode=1;    
 
var timer;
var delay = 100;
 
t = 0;
 
var loop = function () {
 
    if(mode==1)t = t + 10;
    if (t > 500) t = 10;
 
 
    mx = mode;
    h = 0;
    if (Math.random() > 0.9) h = h + 1;
    if (mx == 1) h = h + 1;
    if (h == 2) mode = 2;
 
    h = 0;
    if (Math.random() > 0.9) h = h + 1;
    if (mx == 2) h = h + 1;
    if (h == 2) mode = 1;
 
    if (mode == 1) paint();
    if (mode == 2) paintx();
 
    clearTimeout(timer);
    timer = setTimeout(loop, delay);
}
 
loop();           
 
 
 
}
 
function paint(){ 
 
    var sub=new svgpaint();
 
str="<svg width=\"500\" height=\"500\">";
str=str+sub.rect(0,0,t,t,"blue"); 
str=str+"</svg>";
 
    $("#memo").html(str);   
 
}
 
function paintx(){ 
 
    var sub=new svgpaint();
 
str="<svg width=\"500\" height=\"500\">";
str=str+sub.rect(0,0,500,500,"red"); 
str=str+"</svg>";
 
    $("#memo").html(str);   
 
}
最終更新:2016年04月10日 15:19