アットウィキロゴ

svgsvg7

var x = new Array();
var y = new Array();
var point = new Array();
 
function sample(){
 
    tx = 0;
    for (s = 1; s < 11; s++) {
   for (sx = 1; sx < 11; sx++) {
       tx = tx + 1;
       x[tx] = s;
       y[tx] = sx;
       point[tx] = 100;
 
        } 
    }
 
    var timer;
var delay = 1000;
 
var loop = function () {
 
    n = 100 * Math.random();
    m = Math.floor(n) + 1;
    point[m] = 0;
 
    paint();
 
    clearTimeout(timer);
    timer = setTimeout(loop, delay);
}
 
loop();
 
 
}
 
function paint(){
 
var sub=new svgpaint();
 
str="<svg width=\"500\" height=\"500\">";
for(s=1;s<101;s++){
if(point[s]>50)str=str+sub.rect(50*x[s]-50,50*y[s]-50,50,50,"blue");
if(point[s]<50)str=str+sub.rect(50*x[s]-50,50*y[s]-50,50,50,"red");
}
str=str+"</svg>";
 
$("#memo").html(str);   
 
}
最終更新:2016年02月24日 12:39