你能告訴我如何在畫布上繪畫嗎?下面是HTML 5的代碼:如何在畫布上繪畫?
var TableHeight = 300,
TableWidth = 500,
function init() {
canvas = document.getElementById('canvas');
context = canvas.getContext('2d');
table.draw();
}
table = {
color: '#000',
PositionX : 1,
PositionY: 1,
width: TableWidth,
height: TableHeight,
draw: function(){
context.fillStyle = this.color;
context.fillRect = (this.PositionX, this.PositionY, this.width, this.height);
context.clearRect(5, 5, TableWidth - 10, TableHeight - 10);
}
}
這裏是我的html代碼
<body>
<canvas id ='canvas' width = 500px height = 300px ></canvas>
<script>init()</script>
</body>
對不起,我的英語水平。
我認爲有一些錯誤的代碼,請在問題中指出您精確的查詢。 – Rndm