0
点赞
收藏
分享

微信扫一扫

html5 画布

zhoulujun 2022-01-16 阅读 49
window.onload = function () {
  let vs = document.querySelector('#myCanvas')
  let can = vs.getContext('2d')
  /**
   * 三角形 
   */
  //移动坐标轴
  can.moveTo(50, 50)
  //画直线
  can.lineTo(150, 50)
  can.lineTo(50, 150)
  can.lineTo(50, 50)
  //填充颜色
  can.fillStyle = "#FF0000";
  //画左边是0,0  150*75的正方形
  can.fillRect(0, 0, 150, 75)
  can.stroke()
}
举报

相关推荐

0 条评论