<!DOCTYPE HTML>

<html>

<title>Canvas直线</title>

<body>

<canvas >

您的浏览器不支持 Canvas

</canvas>

<script type="text/javascript">

var c = document.getElementById("myCanvas");

var cxt = c.getContext("2d");

cxt.beginPath();

cxt.moveTo(70,140);

cxt.lineTo(140,70);

cxt.stroke();

</script>

</body>

</html>

效果如下图:

 HTML5 Canvas 绘制斜线

【HTML5 Canvas 又很强的绘图能力,小弟初学,先从直线画起。第一篇文章,后台编辑器还不知怎么用,先这么着吧。】

相关文章:

  • 2021-08-18
  • 2021-10-14
  • 2022-01-20
  • 2022-02-25
  • 2022-12-23
  • 2022-12-23
  • 2021-10-08
  • 2022-01-15
猜你喜欢
  • 2022-01-27
  • 2021-12-04
  • 2022-03-04
  • 2021-05-07
  • 2022-01-28
  • 2021-07-07
相关资源
相似解决方案