你能告诉我如何在画布上作画吗?这是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>
对不起我的英语不好。