html5做的中国象棋棋盘
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
}来自百度文库
qpan.beginPath();
function lhome(x,y){
qpan.moveTo(x,y);
qpan.lineTo(x+100,y
+100);
qpan.lineWidth=2;
qpan.stroke();
}
function rhome(x,y){
qpan.moveTo(x,y);
qpan.lineTo(x-100,y
qpan.moveTo(whole,7);
qpan.lineTo(whole,206);
qpan.closePath();
qpan.stroke();
qpan.beginPath();
qpan.moveTo(whole,256);
qpan.lineTo(whole,height-7);
qpan.closePath();
qpan.closePath();
qpan.lineWidth=1;
qpan.rect(6,6,width-
12,height-2);
qpan.stroke();
for(i=0;i<=7;i++){
var begin=56;
var whole=begin
+i*50;
qpan.beginPath();
</html>
qpan.beginPath();
qpan.moveTo(x+4,y
+12);
qpan.lineTo(x+4,y
+3);
qpan.lineTo(x+13,y
+3);
qpan.stroke();
}
function lcenter(x,y){
qpan.beginPath();
qpan.moveTo(x-4,y-
12);
qpan.lineTo(x-4,y-
3);
qpan.lineTo(x-13,y-
3);
qpan.stroke();
qpan.beginPath();
qpan.moveTo(x-4,y
+12);
qpan.lineTo(x-4,y
+3);
qpan.lineTo(x-13,y
+3);
qpan.stroke();
lcenter(site[i]
[0],site[i][1]);
rcenter(site[i]
[0],site[i][1]);
}
lcenter(406,156);
rcenter(6,156);
lcenter(406,306);
rcenter(6,306);
lhome(156,6);
rhome(256,6);
+100);
qpan.lineWidth=2;
qpan.stroke();
}
function rcenter(x,y){
qpan.beginPath();
qpan.moveTo(x+4,y-
12);
qpan.lineTo(x+4,y-
3);
qpan.lineTo(x+13,y-
3);
qpan.stroke();
var qpan=qp.getContext
("2d");
var
width=qp.width,height=qp.height;
qpan.beginPath();
qpan.strokeStyle='red';
qpan.lineWidth=6;
qpan.rect(0,0,width,height);
qpan.stroke();
qpan.stroke();
}
for(i=0;i<=8;i++){
var begin=56;
var whole=begin
+i*50;
qpan.beginPath();
qpan.moveTo(7,whole);
qpan.lineTo(width-7,whole);
qpan.closePath();
qpan.stroke();
lhome(156,356);
rhome(256,356);
qpan.beginPath();
qpan.font="30px Arial" ;
qpan.strokeText("楚
河",56,241);
qpan.beginPath();
qpan.strokeText("漢
界",256,241);
</script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>中国象棋棋盘</title>
</head>
<body>
<canvas id="qp" width="412"
height="461"></canvas>
</body>
<script type="text/javascript">
}
var site=new Array();
site=[[56,106],[356,106],
[106,156],[206,156],[306,156],[56,356],[356,356],
[106,306],[206,306],[306,306]];
for(i=0;i<site.length;i++){
qpan.beginPath();
function lhome(x,y){
qpan.moveTo(x,y);
qpan.lineTo(x+100,y
+100);
qpan.lineWidth=2;
qpan.stroke();
}
function rhome(x,y){
qpan.moveTo(x,y);
qpan.lineTo(x-100,y
qpan.moveTo(whole,7);
qpan.lineTo(whole,206);
qpan.closePath();
qpan.stroke();
qpan.beginPath();
qpan.moveTo(whole,256);
qpan.lineTo(whole,height-7);
qpan.closePath();
qpan.closePath();
qpan.lineWidth=1;
qpan.rect(6,6,width-
12,height-2);
qpan.stroke();
for(i=0;i<=7;i++){
var begin=56;
var whole=begin
+i*50;
qpan.beginPath();
</html>
qpan.beginPath();
qpan.moveTo(x+4,y
+12);
qpan.lineTo(x+4,y
+3);
qpan.lineTo(x+13,y
+3);
qpan.stroke();
}
function lcenter(x,y){
qpan.beginPath();
qpan.moveTo(x-4,y-
12);
qpan.lineTo(x-4,y-
3);
qpan.lineTo(x-13,y-
3);
qpan.stroke();
qpan.beginPath();
qpan.moveTo(x-4,y
+12);
qpan.lineTo(x-4,y
+3);
qpan.lineTo(x-13,y
+3);
qpan.stroke();
lcenter(site[i]
[0],site[i][1]);
rcenter(site[i]
[0],site[i][1]);
}
lcenter(406,156);
rcenter(6,156);
lcenter(406,306);
rcenter(6,306);
lhome(156,6);
rhome(256,6);
+100);
qpan.lineWidth=2;
qpan.stroke();
}
function rcenter(x,y){
qpan.beginPath();
qpan.moveTo(x+4,y-
12);
qpan.lineTo(x+4,y-
3);
qpan.lineTo(x+13,y-
3);
qpan.stroke();
var qpan=qp.getContext
("2d");
var
width=qp.width,height=qp.height;
qpan.beginPath();
qpan.strokeStyle='red';
qpan.lineWidth=6;
qpan.rect(0,0,width,height);
qpan.stroke();
qpan.stroke();
}
for(i=0;i<=8;i++){
var begin=56;
var whole=begin
+i*50;
qpan.beginPath();
qpan.moveTo(7,whole);
qpan.lineTo(width-7,whole);
qpan.closePath();
qpan.stroke();
lhome(156,356);
rhome(256,356);
qpan.beginPath();
qpan.font="30px Arial" ;
qpan.strokeText("楚
河",56,241);
qpan.beginPath();
qpan.strokeText("漢
界",256,241);
</script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>中国象棋棋盘</title>
</head>
<body>
<canvas id="qp" width="412"
height="461"></canvas>
</body>
<script type="text/javascript">
}
var site=new Array();
site=[[56,106],[356,106],
[106,156],[206,156],[306,156],[56,356],[356,356],
[106,306],[206,306],[306,306]];
for(i=0;i<site.length;i++){