你能告诉我如何在画布上绘画吗?下面是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