每日一个js实例1---纯js与canvas实现心电图网格绘制
来源:互联网 发布:知天下之牛耳 编辑:程序博客网 时间:2024/04/29 10:45
<canvas id="ecg1">浏览器暂不支持h5的canvas元素</canvas>
function drawGrid(id){ this.c_canvas = document.getElementById(id); this.context =this. c_canvas.getContext("2d"); this.w = this.c_canvas.width = window.innerWidth; this.h=this.c_canvas.height =window.innerHeight; this.drawSmallGrid(); this.drawMediumGrid(); this.drawBigGrid(); return;}drawGrid.prototype.drawSmallGrid= function () { this.context.strokeStyle = "#f1dedf"; this.context.strokeWidth=1; this.context.beginPath(); for (var x = 0.5; x < this.w; x += 3) { this.context.moveTo(x, 0); this. context.lineTo(x, this.h); this.context.stroke(); } for (var y = 0.5; y < this.h; y += 3) { this.context.moveTo(0, y); this.context.lineTo(this.w, y); this.context.stroke(); } this. context.closePath(); return;}drawGrid.prototype.drawMediumGrid= function () { this.context.strokeStyle = "#f0adaa"; this.context.strokeWidth=1; this.context.beginPath(); for (var x = 0.5; x < this.w; x += 15) { this.context.moveTo(x, 0); this.context.lineTo(x, this.h); this.context.stroke(); }; for (var y = 0.5; y < this.h; y += 15) { this.context.moveTo(0, y); this.context.lineTo(this.w, y); this.context.stroke(); }; this.context.closePath(); return;}drawGrid.prototype.drawBigGrid= function () { this.context.strokeStyle = "#e0514b"; this.context.strokeWidth=1; this.context.beginPath(); for (var x = 0.5; x < this.w; x += 75) { this.context.moveTo(x, 0); this.context.lineTo(x, this.h); this. context.stroke(); }; for (var y = 0.5; y < this.h; y += 75) { this.context.moveTo(0, y); this. context.lineTo(this.w, y); this.context.stroke(); }; this.context.closePath(); return;}window.onload= function () { var leftgrid=new drawGrid("ecg1");}window.onresize= function () { var leftgrid=new drawGrid("ecg1");}
0 0
- 每日一个js实例1---纯js与canvas实现心电图网格绘制
- 纯js与canvas实现心电图网格绘制
- 每日一个js实例2--js与jq实现走马灯
- 每日一个js实例15--canvas绘图内容打印
- canvas 绘制心电图
- three.js实现一个网格
- html canvas 画心电图网格
- three.js绘制网格
- 纯JS+html5新标签canvas绘制与本地时间同步时针
- 每日一个js实例5--通过面向对象实现运动
- 每日一个js实例6--通过面向对象实现进度条
- 使用canvas简单绘制心电图
- 一个纯js实现树
- 每日一个js实例9--NaN
- 每日一个js实例10--回车键
- 每日一个js实例14--随机数
- 改编:html canvas 画心电图网格
- 纯js实现隔行换色实例
- Ubuntu搭建Git服务器
- 第八周项目3-顺序串算法
- TeamViwer破解5分钟限制,更改Teamviwer ID的方法
- WorkerThread
- 小白如何自学java-新手入门必备知识!
- 每日一个js实例1---纯js与canvas实现心电图网格绘制
- 队列的数组实现(C语言描述)
- 写给程序员的自己
- AVFoundation进行视频录制时超过10s就没声了
- mysql操作
- 借用第三方云平台实现个人相册
- vm linux克隆时IP配置
- Android 中arm64-v8a、armeabi-v7a、armeabi、x86简介~
- hdu1422重温世界杯