アットウィキロゴ

トランプ3

var p1,p2,p3;
var mode1,mode2,mode3;
 
function sample(){
 
var timer;
var delay = 100;
 
faststep();    
 
var loop = function(){
 
move();
 
chx();    
 
paint();    
 
clearTimeout(timer);
timer = setTimeout(loop,delay);
 
}
 
loop();
 
}
 
function chx(){ 
 
if(Math.random()>0.9)mode1=0;
if(Math.random()>0.9)mode2=0;
if(Math.random()>0.9)mode3=0;
 
}
 
function move(){ 
 
if(mode1>50)p1=Math.floor(52*Math.random())+1;    
if(mode2>50)p2=Math.floor(52*Math.random())+1;  
if(mode3>50)p3=Math.floor(52*Math.random())+1;     
 
}
 
function faststep(){
 
mode1=0;
mode2=0;
mode3=0;    
 
p1=Math.floor(52*Math.random())+1;    
p2=Math.floor(52*Math.random())+1;  
p3=Math.floor(52*Math.random())+1;  
 
paint();    
 
 
}
 
function paint(){
 
file="data/"+p1+".png";
 
str="<svg width=\"500\" height=\"500\">";
str=str+img(file,100,100,100,100);
file="data/"+p2+".png";
str=str+img(file,200,100,100,100);
file="data/"+p3+".png";
str=str+img(file,300,100,100,100);   
str=str+"</svg>";
 
$("#memo").html(str);
 
}
 
function play(){
 
mode1=100;    
mode2=100;
mode3=100;    
 
}    
 
 
 
 
function img(im,x1,y1,w1,h1){
 
var str;
 
str="<image xlink:href=";
str=str+chop(im); 
str=str+"x="+chop(x1)+" ";
str=str+"y="+chop(y1)+" ";
str=str+"width="+chop(w1)+" ";
str=str+"height="+chop(h1);
str=str+"/>"
 
 
return str;
 
}
 
function chop(str){ 
 
var strx;
 
strx="\""+str+"\"";
 
return strx;
}
最終更新:2015年04月13日 22:03