アットウィキロゴ

bota

<html>
<head>
<title>slot</title>
<script src="jquery.js"></script>
<script src="sample.js"></script>
<script src="svgpaint.js"></script>
</head>
<body onload="sample()">
<p id="memo"></p>
<input id="bt" type="button" value="stop" />
<input id="bt2" type="button" value="start" />
</body>
</html>
 
var x;
var p;
 
function sample(){
 
    p = 1;
    x=100;
 
    $("#bt").click(function(){
        x=200;   
        });
 $("#bt2").click(function(){
        x=100;   
        });
 
    game();
 
}
 
function game(){
 
var timer;
var delay = 100;
 
p=1;
 
var loop = function () {
 
 
    if (x < 150) p = p + 1;
    if (p > 2) p = 1;
 
    paint();
 
 
 
    clearTimeout(timer);
    timer = setTimeout(loop, delay);
}
 
loop();
 
}
 
function paint(){
 
var sub=new svgpaint();
 
var str="<svg width=\"100\" height=\"100\">";
if(p==1)str=str+sub.rect(50,50,50,50,"red");
if(p==2)str=str+sub.rect(50,50,50,50,"blue");
str=str+"</svg>";
 
$("#memo").html(str);
 
 
}
 
最終更新:2015年05月10日 10:54