アットウィキロゴ

侵略8

var x = new Array();
var y = new Array();
var mode;
 
function sample(){
 
    faststep();
 
    var timer;
var delay = 100;
 
var loop = function () {
 
    move();
 
    change();
 
    if (y[1] < 3) faststep();
 
    paint();
 
    clearTimeout(timer);
    timer = setTimeout(loop, delay);
}
 
loop();
 
 
 
 
 
 
}
 
function faststep(){
 
 mode = 1;
 
    tx=0;
    for (s = 1; s < 6; s++) {
        for (sx = 1; sx < 6; sx++) {
        tx=tx+1;
        x[tx] = 50 + 10 * sx;
        y[tx] = 100-3* s;
        } 
    }
 
 
 
}
 
 
function change(){
 
maxp=0;
for(s=1;s<26;s++){
if(x[s]>maxp)maxp=x[s];    
}
 
minp=101;
for(s=1;s<26;s++){
if(x[s]<minp)minp=x[s];    
}
 
if (mode == 2) mode = 3;
if (mode == 4) mode = 1;
 
h = 0;
if (mode == 1) h = h + 1;
if (maxp > 99) h = h + 1;
if (h == 2) mode = 2;
 
h = 0;
if (mode == 3) h = h + 1;
if (minp <2) h = h + 1;
if (h == 2) mode = 4;
 
 
 
 
}
 
 
function move(){
 
if(mode==1)dx=3;
if(mode==1)dy=0;
 
if(mode==2)dx=0;
if(mode==2)dy=-3;
 
if(mode==3)dx=-3;
if(mode==3)dy=0;
 
if(mode==4)dx=0;
if(mode==4)dy=-3;
 
for(s=1;s<26;s++){
 x[s] = x[s] + dx;
 y[s] = y[s] + dy;
    }
 
 
 
}
 
function paint(){
 
var sub=new svgpaint();
 
str="<svg width=\"700\" height=\"700\">";
for(s=1;s<26;s++){
str=str+sub.rect(5*x[s],500-5*y[s],5,5,"blue");   
}
 
str=str+"</svg>";
 
 
$("#memo").html(str);
 
}
最終更新:2015年06月09日 02:15