アットウィキロゴ

kurasu

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
 
<script>
 
var x=new Array();
var y=new Array();
var life=new Array(); 
var dx=new Array();
 
function sample(){
 
 
 var sub=new f();
 a=sub.pon();
 
 alert(a);
 
 $('#btn').click(function() {
 
   sx=0;
   for(s=1;s<101;s++){
   if(life[s]<50)sx=s;
   }
 
 
   life[sx]=100;
   x[sx]=250;
   y[sx]=0;
 
 
  });
 
 
 
 var timer;
var delay = 100;
 
 
var loop = function () {
 
 for(s=1;s<101;s++){
 y[s]=y[s]+10;
 if(y[s]>500)life[s]=0;
 
 if(x[s]>500)dx[s]=-25;
 if(x[s]<0)dx[s]=25;
 
 x[s]=x[s]+dx[s];
 
 }
  paint();
 
    clearTimeout(timer);
    timer = setTimeout(loop, delay);
}
 
loop();
 
 
 
 
}
 
function paint(){
 var canv = document.getElementById('memo');
 
  var ctx = canv.getContext('2d');
 
 ctx.fillStyle = "white";
ctx.fillRect(0, 0, 500, 500);
 for(s=1;s<101;s++){
 ctx.fillStyle = "red";
if(life[s]>50)ctx.fillRect(x[s], y[s], 10, 10);
 }
 
}
 
class f{
 
pon(){
 
return "neko";
 
 
 
}
 
 
}
 
</script>
最終更新:2017年09月15日 10:17