<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<title>canvas元素示例</title>
<script >
function draw(id)
{
var canvas = document.getElementById(id);
if (canvas == null)
return false;
var context = canvas.getContext('2d');
context.fillStyle = "#EEEEFF";
context.fillRect(0, 0, 400, 300);
context.beginPath();
context.arc( 100, 100, 75, 0, Math.PI * 2, true);
context.closePath();
context.fillStyle = 'rgba(255, 0, 0, 0.25)';
context.fill();
}
</script>
</head>
<body onLoad="draw('canvas');">
<h1>canvas中画圆形</h1>
<canvas id="canvas" width="400" height="300" />
</body>
</html>
html中javascript画圆
最新推荐文章于 2022-09-05 20:43:51 发布