ความคิดเห็น: ฉันเชื่อว่าทุกคนได้กลายเป็นที่รู้จักกันดีสำหรับคำว่า html5 และฟังก์ชั่นของมันมีประสิทธิภาพมาก บทความนี้แนะนำให้คุณใช้ถังขนาดเล็กที่สามารถเคลื่อนย้ายผ่านได้ รายละเอียดมีดังนี้ เพื่อนที่ชอบ HTML สามารถอ้างถึงได้
<! doctype html>
<html>
<head>
</head>
<body onkeydown = "dangeirect ()">
<Canvas> เบราว์เซอร์ของคุณไม่รองรับแท็ก Canvas </anvas>
<script type = "text/javascript">
var canvas1 = document.getElementById ('tankmap');
var ctx = canvas1.getContext ('2d');
var myx = 30;
var myy = 30;
ฟังก์ชั่น drawball () {
ctx.shadowblur = 30, ctx.shadowcolor = "#008c46";
ctx.fillstyle = '#008c46';
ctx.fillrect (myx, myy, 5,30);
ctx.fillrect (myx+17, myy, 5,30);
ctx.fillrect (myx+6, myy+5,10,20);
ctx.beginpath ();
ctx.fillstyle = '#004020';
ctx.arc (myx+11, myy+15,5,0, math.pi*1.5);
ctx.closepath ();
ctx.fill ();
ctx.strokstyle = "#008c46";
ctx.moveto (myx+11, myy+15);
ctx.lineto (myx+11, myy-5);
ctx.stroke ();
-
drawball ();
ฟังก์ชั่นเปลี่ยนไป () {
var code = event.keycode;
สลับ (รหัส) {
กรณีที่ 87:
Myy--;
หยุดพัก;
กรณี 68:
myx ++;
หยุดพัก;
กรณีที่ 83:
Myy ++;
หยุดพัก;
กรณี 65:
myx--;
หยุดพัก;
-
CTX.ClearRect (0,0,500,300);
// ทาสีใหม่
drawball ();
-
</script>
</body>
</html>