Chinaunix首页 | 论坛 | 博客
  • 博客访问: 108436
  • 博文数量: 40
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 423
  • 用 户 组: 普通用户
  • 注册时间: 2013-01-15 11:55
文章分类

全部博文(40)

文章存档

2016年(36)

2015年(2)

2013年(2)

我的朋友

分类: jQuery

2016-03-25 16:26:59

canvas画出向上的箭头,通过这个例子更加详细的了解canvas

点击(此处)折叠或打开

  1. <!DOCTYPE html >
  2. <html>
  3.  <head>
  4.     <title>cars</title>
  5.     <script src=""></script>
  6.  </head>
  7.  <body>
  8.    <canvas id ="canvas" width="200" height="200"></canvas>
  9.    <script>
  10.      var canvas = document.getElementById("canvas");
  11.      var ctx = canvas.getContext("2d");
  12.     ctx.fillStyle = "SkyBlue";
  13.     ctx.lineWidth = 4;
  14.     ctx.beginPath();
  15.     ctx.moveTo(100,100);
  16.     ctx.lineTo(100,60);
  17.     ctx.lineTo(130,30);
  18.     ctx.lineTo(160,60);
  19.     ctx.lineTo(160,100);
  20.     ctx.lineTo(100,100);
  21.     ctx.fill();
  22.    </script>
  23.  </body>
  24. </html>

阅读(650) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~