canvas应用
2024-10-18 08:35:36
<!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>
最新文章
- CI框架,源代码一次性判断获取post(get)数据是否有某个字段值为空方法
- Thread
- Azure Redis Cache (2) 创建和使用Azure Redis Cache
- MongoDB安装部署(一)
- Castle.ActiveRecord (V3.0.0.130)
- 给我发邮件(qq)| 和我联系
- Python 结巴分词
- Outlook2007、2010和Foxmail的簽名設計
- Python中初始化的问题以及注释问题
- 永久性for循环配合switch语句可以实现菜单功能
- UIView的绘制原理
- js判断终端以及APP应用判断
- 自建 yum 源
- webpack 3.X研究
- python更新tomcat脚本
- 【数据结构与算法】自己动手实现图的BFS和DFS(附完整源码)
- Java入门第二季第2章封装
- API接口文档范例
- BER-TLV数据结构
- Android 屏幕适配扫盲、教程
热门文章
- WebAPI之postman变量和session/token
- 【JS】374- 重学 this 关键字
- 常见排序汇总C&;C++
- 了解web漏洞-sql注入
- handler.postDelayed(new Runnable()){ }运行在主线程吗
- 区块链学习——HyperLedger-Fabric v1.0环境搭建详细教程
- 《Java基础知识》Java类的定义及其实例化
- 聊一聊看似简单的Promise.prototype.then()方法
- LeetCode刷题总结-树篇(上)
- 1、看源码MVC如何实例化控制器?