<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 dx=new Array();
var dy=new Array();
var subx=new Array();
var suby=new Array();
function sample(){
dx[1]=1;
dy[1]=0;
dx[2]=0;
dy[2]=1;
dx[3]=0;
dy[3]=-1;
dx[4]=-1;
dy[4]=0;
dx[5]=1;
dy[5]=-1;
dx[6]=-1;
dy[6]=1;
dx[7]=1;
dy[7]=1;
dx[8]=-1;
dy[8]=-1;
x[1]=2;
y[1]=1;
x[2]=2;
y[2]=3;
paint();
}
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<5;s++){
ctx.beginPath();
ctx.moveTo(100,100*s);
ctx.lineTo(400, 100*s);
ctx.closePath();
ctx.stroke();
}
for(s=1;s<5;s++){
ctx.beginPath();
ctx.moveTo(100*s,100);
ctx.lineTo(100*s, 400);
ctx.closePath();
ctx.stroke();
}
ctx.font = "50px 'MS Pゴシック'";
ctx.strokeStyle = "blue";
ctx.strokeText("王", 100*x[1]+20, 50+100*y[1]);
ctx.strokeStyle = "red";
ctx.strokeText("王", 100*x[2]+20, 50+100*y[2]);
}
</script>
最終更新:2017年09月21日 12:17