<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<div id="container">
<canvas id="cavsElem">
你的浏览器不支持canvas,请升级浏览器
</canvas>
</div>
<script>
(function(){
var canvas = document.querySelector('#cavsElem');
var ctx = canvas.getContext("2d");
canvas.width = 600;
canvas.height = 600;
canvas.style.border = "1px solid #000";
ctx.beginPath();
ctx.moveTo(0, 0);
ctx.closePath();
ctx.stroke();
}());
</script>
</body>
</html>
canvas代码段
最新推荐文章于 2021-09-22 18:06:01 发布