`
bcyy
  • 浏览: 1824474 次
文章分类
社区版块
存档分类
最新评论

使用HTML5的canvas做一个会动的时钟

 
阅读更多

HTML5支持canvas了,我们可以直接在页面上绘图了,我看了下canvas和GDI+的接口差不多,所以我们先了解些基本的概念和方式,然后来做一个应用吧。

我们做所有的画之情需要一个画布,html的canvas标签就是帮我们声明了一个画布。

  1. <canvasid="mycanvas">
  2. </canvas>
这个默认的画布的大小是300*150,接下来的工作大多就是javaScript来做了。

首先要实例化这个画布

  1. $(
  2. function(){
  3. varcanvas=document.getElementById("mycanvas");
  4. $.log(canvas.width);
  5. $.log(canvas.height);
  6. varcontext=canvas.getContext("2d");
  7. $.log(context.canvas);
  8. $.log(context.fillStyle);//要填充的区域的颜色
  9. $.log(context.strokeStyle);//要绘制的线条的颜色
  10. $.log(context.lineCap);//笔帽样式
  11. $.log(context.lineJoin);//两条连续线段的连接样式
  12. $.log(context.lineWidth);//线段的宽度
  13. $.log(context.miterLimit);//斜联接
  14. $.log(context.shadowColor);//阴影的颜色,默认为#000000,
  15. $.log(context.shadowOffsetX);//阴影在x方向上的偏移量,默认为0,不受坐标转换的影响。
  16. $.log(context.shadowOffsetY);//阴影在y方向上的偏移量,默认为0,不受坐标转换的影响。
  17. $.log(context.shadowBlur);//阴影的模糊度,默认为0,负数值将会被忽略
  18. }
  19. );
上面的结果你可以得到一个大致的想法,就是content可以认为是我们将来作画用的画笔(估计有专业人士对强烈抗议,我直接忽略),canvas就是我们的画布。我们现在的画笔是2D的画笔,换句话说就是画平面几何的画笔。

接下来,就是我们利用这个画笔来学习怎么画了

各种线

  1. $(
  2. function(){
  3. varcanvas=document.getElementById("mycanvas");
  4. varcontext=canvas.getContext("2d");
  5. context.strokeStyle="rgb(255,0,0)";
  6. context.beginPath();
  7. context.lineCap="butt";//默认
  8. context.lineWidth=10;
  9. context.moveTo(10,10);
  10. context.lineTo(100,10);//简单的一条线
  11. context.stroke();//该方法真正在画布上绘制该线段
  12. context.beginPath();
  13. context.lineCap="round";//圆形线头
  14. context.moveTo(10,30);
  15. context.lineTo(100,30);
  16. context.stroke();//该方法真正在画布上绘制该线段
  17. context.beginPath();
  18. context.lineCap="square";//方形线头
  19. context.moveTo(10,50);
  20. context.lineTo(100,50);
  21. context.stroke();//该方法真正在画布上绘制该线段
  22. }
  23. );
各种阴影
  1. $(
  2. function(){
  3. varcanvas=document.getElementById("mycanvas");
  4. varcontext=canvas.getContext("2d");
  5. context.strokeStyle="rgb(255,0,0)";
  6. context.lineWidth=10;
  7. context.shadowColor="#0000FF";
  8. context.beginPath();
  9. context.lineCap="round";
  10. context.moveTo(10,10);
  11. context.lineTo(100,10);
  12. context.shadowOffsetX=10;
  13. context.shadowBlur=10;
  14. context.stroke();
  15. context.beginPath();
  16. context.lineCap="round";
  17. context.moveTo(10,30);
  18. context.lineTo(100,30);
  19. context.shadowOffsetY=10;
  20. context.shadowBlur=10;
  21. context.stroke();
  22. }
  23. );
各种线∠连接
  1. $(
  2. function(){
  3. varcanvas=document.getElementById("mycanvas");
  4. varcontext=canvas.getContext("2d");
  5. context.strokeStyle="rgb(255,0,0)";
  6. context.lineWidth=10;
  7. context.shadowColor="#0000FF";
  8. context.beginPath();
  9. context.lineJoin="miter";//两条线段的外边缘一直扩展到它们相交
  10. context.moveTo(10,70);
  11. context.lineTo(50,10);
  12. context.lineTo(80,70);
  13. context.stroke();
  14. context.lineJoin="bevel";//以一个斜边进行连接
  15. context.moveTo(100,70);
  16. context.lineTo(140,10);
  17. context.lineTo(180,70);
  18. context.stroke();
  19. context.lineJoin="round";//:以一个圆弧边进行连接
  20. context.beginPath();
  21. context.moveTo(200,70);
  22. context.lineTo(240,10);
  23. context.lineTo(280,70);
  24. context.stroke();
  25. context.closePath();//关闭path
  26. }
  27. );



mitre的限定
  1. $(
  2. function(){
  3. varcanvas=document.getElementById("mycanvas");
  4. varcontext=canvas.getContext("2d");
  5. context.strokeStyle="rgb(255,0,0)";
  6. context.lineWidth=10;
  7. context.shadowColor="#0000FF";
  8. context.beginPath();
  9. context.miterLimit=1;//miterLimit属性为斜面的长度设置一个上限。
  10. //只对线条使用设置为"miter"的lineJoin属性绘制并且两条线段以锐角相交的时候有效
  11. context.lineJoin="miter";//两条线段的外边缘一直扩展到它们相交
  12. context.moveTo(10,70);
  13. context.lineTo(50,10);
  14. context.lineTo(80,70);
  15. context.stroke();
  16. }
  17. );

各种几何图形

  1. $(
  2. function(){
  3. varcanvas=document.getElementById("mycanvas");
  4. canvas.height=500;//改变默认高度
  5. canvas.width=500;
  6. varcontext=canvas.getContext("2d");
  7. context.strokeStyle="rgb(255,0,0)";
  8. context.fillStyle="#AABBCC";
  9. context.lineWidth=2;
  10. context.shadowColor="#0000FF";
  11. //矩形
  12. context.beginPath();
  13. context.fillRect(10,10,50,50);//实体矩形:x,y,width,height
  14. context.strokeRect(70,10,50,50)//空心矩形:x,y,width,height
  15. //context.move(10,100);
  16. //圆弧:x,y,radius,startAngle,endAngle,anticlockwise
  17. context.beginPath();
  18. context.arc(35,110,25,(Math.PI/180)*0,(Math.PI/180)*360,false);
  19. context.stroke();
  20. //context.closePath();
  21. context.beginPath();
  22. context.arc(85,110,25,(Math.PI/180)*0,(Math.PI/180)*180,false);
  23. context.stroke();
  24. //context.closePath();
  25. context.beginPath();
  26. context.arc(135,110,25,(Math.PI/180)*0,(Math.PI/180)*180,true);
  27. context.stroke();
  28. //context.closePath();
  29. context.beginPath();
  30. context.arc(185,110,25,(Math.PI/180)*180,(Math.PI/180)*360,true);
  31. context.stroke();
  32. //context.closePath();
  33. context.beginPath();
  34. context.arc(235,110,25,(Math.PI/180)*90,(Math.PI/180)*0,false);
  35. context.fillStyle="blue";
  36. context.fill();
  37. //context.stroke();
  38. //context.closePath();
  39. context.beginPath();
  40. context.arc(285,110,25,(Math.PI/180)*180,(Math.PI/180)*45,false);
  41. context.closePath();
  42. context.stroke();
  43. context.beginPath();
  44. context.arc(335,110,25,(Math.PI/180)*180,(Math.PI/180)*45,false);
  45. context.closePath();
  46. context.fillStyle="blue";
  47. context.fill();
  48. context.stroke();
  49. //曲线
  50. context.beginPath();
  51. context.moveTo(10,160);//二次贝塞尔曲线的起始点
  52. //controlX,controlY,endX,endY
  53. context.quadraticCurveTo(70,280,235,140);
  54. context.stroke();
  55. context.closePath();
  56. context.beginPath();
  57. context.moveTo(10,300);//三次贝塞尔曲线的起始点
  58. //controlX1,controlY1,controlX2,controlY2,endX,endY
  59. context.bezierCurveTo(70,280,50,400,235,190);
  60. context.stroke();
  61. context.closePath();
  62. }
  63. );
各种变换

记得CSS3中的transform不?canvas肯定也有啊

平移

  1. $(
  2. function(){
  3. varcanvas=document.getElementById("mycanvas");
  4. canvas.height=500;//改变默认高度
  5. canvas.width=500;
  6. varcontext=canvas.getContext("2d");
  7. context.strokeStyle="rgb(255,0,0)";
  8. context.fillStyle="#AABBCC";
  9. context.lineWidth=2;
  10. context.shadowColor="#0000FF";
  11. context.moveTo(10,10);
  12. //context.beginPath();
  13. //context.beginPath();
  14. context.fillRect(10,10,50,50);//实体矩形:x,y,width,height
  15. //context.stroke();
  16. $(canvas).on(
  17. "click",
  18. {"context":context},
  19. function(e){
  20. $.log(e.data.context);
  21. varctx=e.data.context;
  22. ctx.translate(10,10);//再最后的路径点上偏移10*10的位置
  23. context.fillRect(10,10,50,50);
  24. context.stroke();
  25. }
  26. );
  27. }
  28. );
缩放
  1. $(
  2. function(){
  3. varcanvas=document.getElementById("mycanvas");
  4. canvas.height=500;//改变默认高度
  5. canvas.width=500;
  6. varcontext=canvas.getContext("2d");
  7. context.strokeStyle="rgb(255,0,0)";
  8. context.fillStyle="#AABBCC";
  9. context.lineWidth=2;
  10. context.shadowColor="#0000FF";
  11. context.moveTo(10,10);
  12. //context.beginPath();
  13. //context.beginPath();
  14. context.fillRect(10,10,50,50);//实体矩形:x,y,width,height
  15. //context.stroke();
  16. $(canvas).on(
  17. "click",
  18. {"context":context},
  19. function(e){
  20. $.log(e.data.context);
  21. varctx=e.data.context;
  22. ctx.scale(1.1,1.1);//在最后的大小基础上缩放倍数必须是正数
  23. context.fillRect(10,10,50,50);
  24. context.stroke();
  25. }
  26. );
  27. }
  28. );

旋转

  1. $(
  2. function(){
  3. varcanvas=document.getElementById("mycanvas");
  4. canvas.height=500;//改变默认高度
  5. canvas.width=500;
  6. varcontext=canvas.getContext("2d");
  7. context.strokeStyle="rgb(255,0,0)";
  8. context.fillStyle="#AABBCC";
  9. context.lineWidth=2;
  10. context.shadowColor="#0000FF";
  11. context.moveTo(10,10);
  12. //context.beginPath();
  13. //context.beginPath();
  14. context.fillRect(10,10,50,50);//实体矩形:x,y,width,height
  15. //context.stroke();
  16. $(canvas).on(
  17. "click",
  18. {"context":context},
  19. function(e){
  20. $.log(e.data.context);
  21. varctx=e.data.context;
  22. ctx.rotate((Math.PI/180)*10);//旋转的角度,旋转的中心是canvas坐标原点
  23. context.fillRect(10,10,50,50);
  24. context.stroke();
  25. }
  26. );
  27. }
  28. );
transform,transform的参数比较多,也比较难理解,简单的说transform是最自由的变形方式,下面给出些参考
  1. //以下两段代码结果一致
  2. context.transform(1,0,0,1,10,10)
  3. context.translate(10,10);
  4. //以下两段代码结果一致
  5. context.transform(10,0,0,10,0,0);
  6. context.scale(10,10);
  7. //以下三段代码结果一致
  8. context.transform(Math.cos((Math.PI/180)*10),Math.sin((Math.PI/180)*10),-Math.sin((Math.PI/180)*10),Math.cos((Math.PI/180))*10,0,0);
  9. context.transform(-Math.sin((Math.PI/180)*10),Math.cos((Math.PI/180)*10),Math.cos((Math.PI/180)*10),Math.sin((Math.PI/180)*10),0,0);
  10. context.rotate(10);


组合
  1. $(
  2. function(){
  3. varcanvas=document.getElementById("mycanvas");
  4. canvas.height=100;
  5. canvas.width=100;
  6. varcontext=canvas.getContext("2d");
  7. context.fillStyle="#AABBCC";
  8. context.fillRect(10,10,50,50);
  9. //默认新图形会覆盖在原有内容之上
  10. context.globalCompositeOperation="source-over";
  11. context.fillStyle="blue";
  12. context.arc(70,30,25,(Math.PI/180)*0,(Math.PI/180)*360,false);
  13. context.fill();
  14. $("span").html(context.globalCompositeOperation);
  15. $(canvas).toggle(
  16. function(){
  17. canvas.width=100;
  18. //原有内容之下绘制新图形
  19. context.clearRect(0,0,500,500);
  20. context.beginPath();
  21. context=canvas.getContext("2d");
  22. context.fillStyle="#AABBCC";
  23. context.fillRect(10,10,50,50);
  24. context.globalCompositeOperation="destination-over";
  25. context.fillStyle="blue";
  26. context.arc(70,30,25,(Math.PI/180)*0,(Math.PI/180)*360,false);
  27. context.fill();
  28. $("span").html(context.globalCompositeOperation);
  29. },
  30. function(){
  31. canvas.width=100;
  32. //新图形会仅仅出现与原有内容重叠的部分。其它区域都变成透明的
  33. context.clearRect(0,0,500,500);
  34. context.beginPath();
  35. context.fillStyle="#AABBCC";
  36. context.fillRect(10,10,50,50);
  37. context.globalCompositeOperation="source-in";
  38. context.fillStyle="blue";
  39. context.arc(70,30,25,(Math.PI/180)*0,(Math.PI/180)*360,false);
  40. context.fill();
  41. $("span").html(context.globalCompositeOperation);
  42. },
  43. function(){
  44. canvas.width=100;
  45. //原有内容中与新图形重叠的部分会被保留,其它区域都变成透明的destination-in
  46. context.clearRect(0,0,500,500);
  47. context.beginPath();
  48. context=canvas.getContext("2d");
  49. context.fillStyle="#AABBCC";
  50. context.fillRect(10,10,50,50);
  51. context.globalCompositeOperation="destination-in";
  52. context.fillStyle="blue";
  53. context.arc(70,30,25,(Math.PI/180)*0,(Math.PI/180)*360,false);
  54. context.fill();
  55. $("span").html(context.globalCompositeOperation);
  56. },
  57. function(){
  58. canvas.width=100;
  59. //只有新图形中与原有内容不重叠的部分会被绘制出来source-out
  60. context.clearRect(0,0,500,500);
  61. context.beginPath();
  62. context=canvas.getContext("2d");
  63. context.fillStyle="#AABBCC";
  64. context.fillRect(10,10,50,50);
  65. context.globalCompositeOperation="source-out";
  66. context.fillStyle="blue";
  67. context.arc(70,30,25,(Math.PI/180)*0,(Math.PI/180)*360,false);
  68. context.fill();
  69. $("span").html(context.globalCompositeOperation);
  70. },
  71. function(){
  72. canvas.width=100;
  73. //原有内容中与新图形不重叠的部分会被保留
  74. context.clearRect(0,0,500,500);
  75. context.beginPath();
  76. context=canvas.getContext("2d");
  77. context.fillStyle="#AABBCC";
  78. context.fillRect(10,10,50,50);
  79. context.globalCompositeOperation="destination-out";
  80. context.fillStyle="blue";
  81. context.arc(70,30,25,(Math.PI/180)*0,(Math.PI/180)*360,false);
  82. context.fill();
  83. $("span").html(context.globalCompositeOperation);
  84. },
  85. function(){
  86. canvas.width=100;
  87. //新图形中与原有内容重叠的部分会被绘制,并覆盖于原有内容之上
  88. context.clearRect(0,0,500,500);
  89. context.beginPath();
  90. context=canvas.getContext("2d");
  91. context.fillStyle="#AABBCC";
  92. context.fillRect(10,10,50,50);
  93. context.globalCompositeOperation="source-atop";
  94. context.fillStyle="blue";
  95. context.arc(70,30,25,(Math.PI/180)*0,(Math.PI/180)*360,false);
  96. context.fill();
  97. $("span").html(context.globalCompositeOperation);
  98. },
  99. function(){
  100. canvas.width=100;
  101. //原有内容中与新内容重叠的部分会被保留,并会在原有内容之下绘制新图形
  102. context.clearRect(0,0,500,500);
  103. context.beginPath();
  104. context=canvas.getContext("2d");
  105. context.fillStyle="#AABBCC";
  106. context.fillRect(10,10,50,50);
  107. context.globalCompositeOperation="destination-atop";
  108. context.fillStyle="blue";
  109. context.arc(70,30,25,(Math.PI/180)*0,(Math.PI/180)*360,false);
  110. context.fill();
  111. $("span").html(context.globalCompositeOperation);
  112. },
  113. function(){
  114. canvas.width=100;
  115. //两图形中重叠部分作加色处理
  116. context.clearRect(0,0,500,500);
  117. context.beginPath();
  118. context=canvas.getContext("2d");
  119. context.fillStyle="#AABBCC";
  120. context.fillRect(10,10,50,50);
  121. context.globalCompositeOperation="lighter";
  122. context.fillStyle="blue";
  123. context.arc(70,30,25,(Math.PI/180)*0,(Math.PI/180)*360,false);
  124. context.fill();
  125. $("span").html(context.globalCompositeOperation);
  126. },
  127. function(){
  128. canvas.width=100;
  129. //两图形中重叠的部分作减色处理darker
  130. context.clearRect(0,0,500,500);
  131. context.beginPath();
  132. context=canvas.getContext("2d");
  133. context.fillStyle="#AABBCC";
  134. context.fillRect(10,10,50,50);
  135. context.globalCompositeOperation="darker";
  136. context.fillStyle="blue";
  137. context.arc(70,30,25,(Math.PI/180)*0,(Math.PI/180)*360,false);
  138. context.fill();
  139. $("span").html(context.globalCompositeOperation);
  140. },
  141. function(){
  142. canvas.width=100;
  143. //重叠的部分会变成透明
  144. context.clearRect(0,0,500,500);
  145. context.beginPath();
  146. context=canvas.getContext("2d");
  147. context.fillStyle="#AABBCC";
  148. context.fillRect(10,10,50,50);
  149. context.globalCompositeOperation="xor";
  150. context.fillStyle="blue";
  151. context.arc(70,30,25,(Math.PI/180)*0,(Math.PI/180)*360,false);
  152. context.fill();
  153. $("span").html(context.globalCompositeOperation);
  154. },
  155. function(){
  156. canvas.width=100;
  157. //只有新图形会被保留,其它都被清除掉
  158. context.clearRect(0,0,500,500);
  159. context.beginPath();
  160. context=canvas.getContext("2d");
  161. context.fillStyle="#AABBCC";
  162. context.fillRect(10,10,50,50);
  163. context.globalCompositeOperation="copy";
  164. context.fillStyle="blue";
  165. context.arc(70,30,25,(Math.PI/180)*0,(Math.PI/180)*360,false);
  166. context.fill();
  167. $("span").html(context.globalCompositeOperation);
  168. alert("演示结束");
  169. }
  170. );
  171. }
  172. );
字体(看文档说canvas的字体支持CSS样式的描写,但是,我不知道怎么样让canvas的font支持CSS3的在线字体)
  1. <scriptsrc=../../"js/jquery-1.7.1.min.js"type="text/javascript"></script>
  2. <linkrel="stylesheet"type="text/css"href=../../"http://fonts.googleapis.com/css?family=Tangerine">
  3. <scripttype="text/javascript">
  4. $.log=function(msg){
  5. console.log(msg);
  6. }
  7. $(
  8. function(){
  9. varcanvas=document.getElementById("mycanvas");
  10. canvas.height=200;
  11. canvas.width=200;
  12. varcontext=canvas.getContext("2d");
  13. context.font="20px新宋体";
  14. context.fillText("这是实心新宋体",10,30);
  15. context.strokeText("这是空心新宋体",10,60);
  16. context.font="20pxTangerineserif";
  17. context.fillText("HelloHTML5",10,100);
  18. context.strokeText("HelloHTML5",10,150);
  19. }
  20. );
  21. </script>
我们尝试写一圈旋转的文字,吧上面的知识点合起来看看效果
  1. $(
  2. function(){
  3. varcanvas=document.getElementById("mycanvas");
  4. canvas.height=500;
  5. canvas.width=500;
  6. varcontext=canvas.getContext("2d");
  7. context.translate(150,150);
  8. context.scale(0.7,0.7);
  9. context.font="12pxTahoma";
  10. for(vari=0;i<12;i++){
  11. context.fillText((i+3)%12==0?12:(i+3)%12,150,10);
  12. context.rotate((Math.PI/6));
  13. }
  14. }
  15. );


在具体绘制的时候,定位总是让我这样没有空间感的人感觉痛苦,所以我现在canvas上画上很多格子,帮助我进行布局

  1. $(
  2. function(){
  3. varcanvas=document.getElementById("mycanvas");
  4. canvas.height=500;
  5. canvas.width=500;
  6. varcontext=canvas.getContext("2d");
  7. context.lineWidth=1;
  8. context.strokeStyle="rgb(211,211,211)";
  9. for(vari=0;i<50;i++){
  10. $.log(i);
  11. context.moveTo(i*10,0);
  12. context.lineTo(i*10,500);
  13. context.stroke();
  14. }
  15. for(vari=0;i<50;i++){
  16. $.log(i);
  17. context.moveTo(0,i*10);
  18. context.lineTo(500,i*10);
  19. context.stroke();
  20. }
  21. }
  22. );
前面的准备工作都完成了,现在我们来综合下,完成一个具有时分秒的会动的钟
  1. $(
  2. function(){
  3. clock();
  4. setInterval(clock,1000);
  5. }
  6. );
  7. functionclock(){
  8. varcanvas=document.getElementById("mycanvas");
  9. canvas.height=500;
  10. canvas.width=500;
  11. varcontext=canvas.getContext("2d");
  12. context.beginPath();
  13. context.lineWidth=1;
  14. context.strokeStyle="rgb(211,211,211)";
  15. for(vari=0;i<50;i++){
  16. $.log(i);
  17. context.moveTo(i*10,0);
  18. context.lineTo(i*10,500);
  19. context.stroke();
  20. }
  21. for(vari=0;i<50;i++){
  22. $.log(i);
  23. context.moveTo(0,i*10);
  24. context.lineTo(500,i*10);
  25. context.stroke();
  26. }
  27. context.beginPath();
  28. context.strokeStyle="rgb(255,0,0)";
  29. context.arc(250,250,200,(Math.PI/180)*0,(Math.PI/180)*360,false);
  30. context.stroke();
  31. context.save();//存储当前画布坐标系状态
  32. context.beginPath();
  33. context.font="14pxTahoma"
  34. context.translate(255,255);//将坐标系坐标原点移至图中间
  35. context.strokeStyle="#FFFFFF";
  36. for(vari=0;i<12;i++){
  37. context.fillText((i+3)%12==0?12:(i+3)%12,180,0);
  38. context.rotate((Math.PI/6));
  39. }
  40. context.restore();
  41. context.save();
  42. context.beginPath();
  43. context.lineWidth=5;
  44. context.translate(255,255);//将坐标系坐标原点移至图中间
  45. for(i=0;i<60;i++){
  46. if(i%5!=0){
  47. context.beginPath();
  48. context.moveTo(180,0);
  49. context.lineTo(190,0);
  50. context.stroke();
  51. }
  52. context.rotate(Math.PI/30);
  53. }
  54. context.restore();
  55. varnow=newDate();
  56. varsec=now.getSeconds();
  57. varmin=now.getMinutes();
  58. varhr=now.getHours()>=12?now.getHours()-12:now.getHours();
  59. context.save();
  60. context.translate(255,255);//将坐标系坐标原点移至图中间
  61. //-(Math.PI/6)*3是因为0度在3点这里
  62. context.rotate(hr*(Math.PI/6)+(Math.PI/360)*min+(Math.PI/21600)*sec-(Math.PI/6)*3);
  63. context.lineWidth=14;
  64. context.beginPath();
  65. context.moveTo(-20,0);
  66. context.lineTo(150,0);
  67. context.stroke();
  68. context.restore();
  69. context.save();
  70. context.translate(255,255);//将坐标系坐标原点移至图中间
  71. context.rotate(min*(Math.PI/30)+(Math.PI/1800)*sec-(Math.PI/6)*3)
  72. context.lineWidth=10;
  73. context.beginPath();
  74. context.moveTo(-28,0);
  75. context.lineTo(160,0);
  76. context.stroke();
  77. context.restore();
  78. context.save();
  79. context.translate(255,255);//将坐标系坐标原点移至图中间
  80. context.lineWidth=1;
  81. context.rotate(sec*(Math.PI/30)+(Math.PI/1800)*sec-(Math.PI/6)*3)
  82. context.lineWidth=10;
  83. context.beginPath();
  84. context.moveTo(-28,0);
  85. context.lineTo(160,0);
  86. context.stroke();
  87. context.restore();
  88. }

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics