HTML Canvas Game: Simple Drawing Example
<html>
<body>
<p><canvas id='myCanvas' width='500' height='500'></canvas></p>
<script>
var canvas = document.getElementById('myCanvas');
var ctx = canvas.getContext('2d');
ctx.fillStyle = '#FF0000';
ctx.fillRect(0, 0, 150, 75);
//Draw a circle
ctx.beginPath();
ctx.arc(100, 100, 50, 0, 2 * Math.PI);
ctx.stroke();
</script>
</body>
</html>
原文地址: https://www.cveoy.top/t/topic/lmbd 著作权归作者所有。请勿转载和采集!