<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>绘制直线</title> </head> <body>
<canvas id="cloth" width="200" heigth="200" style="border:1px solid #ff0000;">
Your browser does not support the canvas element.
</canvas> <script type="text/javascript">
var c = document.getElementById("cloth");
var ece = c.getContext("2d");
//直线
// ece.moveTo(10,10);
// ece.lineTo(150,50);
// ece.lineTo(10,50);
// ece.lineTo(10,10);
// ece.fillStyle="#ff0000";
// ece.fill();
// ece.lineWidth=5;
// ece.strokeStyle="#00ff00";
// ece.stroke(); //圆形
// ece.beginPath();
// ece.arc(50,50,50,0,2*Math.PI);
// ece.fillStyle="#00ff00";
// ece.closePath();
// ece.fill(); //渐变色
var grd=ece.createLinearGradient(0,0,175,50);
grd.addColorStop(0,"#FF0000");
grd.addColorStop(1,"#0000FF");
ece.fillStyle=grd;
ece.fillRect(0,0,175,50); </script>
</body>
</html>

最新文章

  1. CI框架,源代码一次性判断获取post(get)数据是否有某个字段值为空方法
  2. Thread
  3. Azure Redis Cache (2) 创建和使用Azure Redis Cache
  4. MongoDB安装部署(一)
  5. Castle.ActiveRecord (V3.0.0.130)
  6. 给我发邮件(qq)| 和我联系
  7. Python 结巴分词
  8. Outlook2007、2010和Foxmail的簽名設計
  9. Python中初始化的问题以及注释问题
  10. 永久性for循环配合switch语句可以实现菜单功能
  11. UIView的绘制原理
  12. js判断终端以及APP应用判断
  13. 自建 yum 源
  14. webpack 3.X研究
  15. python更新tomcat脚本
  16. 【数据结构与算法】自己动手实现图的BFS和DFS(附完整源码)
  17. Java入门第二季第2章封装
  18. API接口文档范例
  19. BER-TLV数据结构
  20. Android 屏幕适配扫盲、教程

热门文章

  1. WebAPI之postman变量和session/token
  2. 【JS】374- 重学 this 关键字
  3. 常见排序汇总C&amp;C++
  4. 了解web漏洞-sql注入
  5. handler.postDelayed(new Runnable()){ }运行在主线程吗
  6. 区块链学习——HyperLedger-Fabric v1.0环境搭建详细教程
  7. 《Java基础知识》Java类的定义及其实例化
  8. 聊一聊看似简单的Promise.prototype.then()方法
  9. LeetCode刷题总结-树篇(上)
  10. 1、看源码MVC如何实例化控制器?