canvas实现手机的手势解锁的步骤详细
|
//触摸点移动时的动画 canvasLock.prototype.update=function(po){ //清屏,canvas动画前必须清空原来的内容 this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height); //以给定坐标点为圆心画出所有圆 for(var i=0;i<this.arr.length;i++){ this.drawCircle(this.arr[i].x,this.arr[i].y); } this.drawPoint();//点击过的圆画实心圆 this.drawLine(po);//画线 } //画实心圆 canvasLock.prototype.drawPoint=function(){ for(var i=0;i<this.lastPoint.length;i++){ this.ctx.fillStyle="#abcdef"; this.ctx.beginPath(); this.ctx.arc(this.lastPoint[i].x,this.lastPoint[i].y,this.r/2,0,2*Math.PI,true); this.ctx.closePath(); this.ctx.fill(); } } //画线 canvasLock.prototype.drawLine=function(po){ this.ctx.beginPath(); this.lineWidth=3; this.ctx.moveTo(this.lastPoint[0].x,this.lastPoint[0].y);//线条起点 for(var i=1;i<this.lastPoint.length;i++){ this.ctx.lineTo(this.lastPoint[i].x,this.lastPoint[i].y); } this.ctx.lineTo(po.x,po.y);//触摸点 this.ctx.stroke(); this.ctx.closePath(); } 效果图 4、canvas手势链接操作实现 在touchmove中补充当碰到下一个目标圆时的操作 (编辑:珠海站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- 2月数据库排行榜:MySQL分数增长迅猛,Oracle下降最多
- 为大型数据集实现快速查找:MySQL MEMORY(HEAP),Memcached或
- MySQL运维实战之PHP访问MySQL你使用对了吗
- mysql – 为公众提供在数据库上运行SELECT查询的方法有多危
- 应用实践:四步法分析定位生产环境下MySQL上千条SQL中的问题
- mysql – Ruby的has_header方法在哪里查找头文件?
- Java SE上的JPA:对象:entity.Customer@5e80188f不是已知的
- mysql-当事件循环正在等待数据库操作时,如何处理对nodejs服
- SQLServer中的substring函数
- mysql查询今天、昨天、7天、近30天、本月数据

