jQuery实现的指纹扫描效果实例(附演示与demo源码下载)


Posted in Javascript onJanuary 26, 2016

本文实例讲述了jQuery实现的指纹扫描效果。分享给大家供大家参考,具体如下:

运行效果截图如下:

jQuery实现的指纹扫描效果实例(附演示与demo源码下载)

点击此处查看在线演示效果。

具体代码如下:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>demo</title>
    <style type="text/css">
      body {
        background:black;
      }
      .dialog {
        width:300px; height:300px; position:fixed; left:50%; margin-left:-150px; border:2px dashed green;
        top:50px;
      }
      .dialog .shape {
        background:black; width:300px; height:300px; z-index:1;
      }
      .dialog .eye {
        width:200px; height:200px; position:absolute; left:50px; top:50px;
        z-index:2;
      }
      #container {
        position:relative;
      }
      .line {
        position:absolute; left:0px; top:0px; font-size:0px; z-index:10;
        background:green;
      }
      .btnGroup {
        text-align:center;
      }
      .btnGroup button {
        width:50px; height:40px; 
      }
      .dialog.output {
        top:400px; display:none;
      }
      #power {
        border:1px solid green; position:fixed; right:20px; bottom:20px;
        color:green; line-height:50px; font-size:30px; 
      }
      .title {
        line-height:50px; font-size:25px; color:#8F8383; text-shadow:0px 0px 3px green;
        text-align:center;
      }
    </style>
  </head>
  <body>
    <div class="dialog">
      <div id="container">
        <div class="shape"></div>
        <img src="finger.png" class="eye" />
      </div>
      <div class="btnGroup">
        <button id="vSee">竖向扫描</button>
        <button id="hSee">横向扫描</button>
        <button id="bSee">双向扫描</button>
        <button id="dSee">深度扫描</button>
      </div>
    </div>
    <div class="dialog output" id="outputContainer">
      <img src="finger.png" class="eye" />
    </div>
  </body>
  <script type="text/javascript" src="jquery.js"></script>
  <script type="text/javascript">
    var container = $("#container");
    var outputContainer = $("#outputContainer");
    function Line(type) {
      var self = this;
      self.type = type || "V";
      var body = $("<div class='line'></div>");
      switch(this.type) {
        case "V": // 竖直
          body.css({
            "width": "1px",
            "height": "300px"
          });
        break;
        case "H": // 水平
          body.css({
            "width": "300px",
            "height": "1px"
          });
        break;
      }
      container.append(body);
      self.body = body;
      self.direct = self.type === "V" ? "R" : "B";
      self.run = function() {
        switch(self.direct) {
          case "L":
            self.body.animate({"left":0}, 1000, null, function() {
              self.direct = "R";
              self.run();
            });
          break;
          case "R":
            self.body.animate({"left":300}, 1000, null, function() {
              self.direct = "L";
              self.run();
            });
          break;
          case "T":
            self.body.animate({"top":0}, 1000, null, function() {
              self.direct = "B";
              self.run();
            });
          break;
          case "B":
            self.body.animate({"top":300}, 1000, null, function() {
              self.direct = "T";
              self.run();
            });
          break;
        }
      }
      self.run();
    }
    var lineArray = [];
    function output(type, time, opactiy) {
      time = time || 2000;
      var initHeight = type === "H" ? 0 : 300;
      var initWidth = type === "H" ? 300 : 0;
      type === "B" && (initHeight = initWidth = 0);
      outputContainer.css({
        "height": initHeight,
        "width": initWidth,
        "display": "block",
        "opacity": opactiy || 1
      });
      outputContainer.animate({"height":300, "width":300}, time, null);
    }
    function clear() {
      for(var i=0, len=lineArray.length; i<len; i++) {
        var line = lineArray[i];
        line.body.stop().remove();
      }
      container.find(".line").remove();
      outputContainer.stop().css({"display": "none", "opacity": 0});
    }
    $("#hSee").click(function() {
      clear();
      lineArray.push(new Line("H"));
      output("H", null, 0.5);
    });
    $("#vSee").click(function() {
      clear();
      lineArray.push(new Line("V"));
      output("V", null, 0.5);
    });
    $("#bSee").click(function() {
      clear();
      lineArray.push(new Line("H"), new Line("V"));
      output("B", 3500, 0.8);
    });
    $("#dSee").click(function() {
      clear();
      for(var i=0; i<5; i++) {
        (function(index) {
          setTimeout(function() {
            lineArray.push(new Line("H"), new Line("V"));
          }, index*200);
        })(i);
      }
      output("B", 5000, 1.0);
    });
  </script>
</html>

完整实例代码点击此处本站下载。

希望本文所述对大家jQuery程序设计有所帮助。

Javascript 相关文章推荐
图片上传即时显示缩略图的js代码
May 27 Javascript
jquery ajax属性async(同步异步)示例
Nov 05 Javascript
jQuery 删除或是清空某个HTML元素示例
Aug 04 Javascript
jquery使整个div区域可以点击的方法
Jun 24 Javascript
JavaScript对Cookie进行读写操作实例
Jul 25 Javascript
AngularJS+Bootstrap实现多文件上传与管理
Nov 08 Javascript
JavaScript的事件机制详解
Jan 17 Javascript
vue.js的手脚架vue-cli项目搭建的步骤
Aug 30 Javascript
JS匿名函数和匿名自执行函数概念与用法分析
Mar 16 Javascript
vue实现一个炫酷的日历组件
Oct 08 Javascript
layui将table转化表单显示的方法(即table.render转为表单展示)
Sep 24 Javascript
js实现限定范围拖拽的示例
Oct 26 Javascript
Bootstrap树形组件jqTree的简单封装
Jan 25 #Javascript
javascript实现2016新年版日历
Jan 25 #Javascript
基于javascript实现图片左右切换效果
Jan 25 #Javascript
JavaScript实现获取某个元素相邻兄弟节点的prev与next方法
Jan 25 #Javascript
JavaScript事件类型中焦点、鼠标和滚轮事件详解
Jan 25 #Javascript
JavaScript实现给定时间相加天数的方法
Jan 25 #Javascript
jQuery中inArray方法注意事项分析
Jan 25 #Javascript
You might like
php Smarty模板生成html文档的方法
2010/04/12 PHP
如何设置mysql允许外网访问
2013/06/04 PHP
解析php中const与define的应用区别
2013/06/18 PHP
解析在apache里面给php写虚拟目录的详细方法
2013/06/24 PHP
PHP基于GD库的图像处理方法小结
2016/09/27 PHP
THINKPHP在添加数据的时候获取主键id的值方法
2017/04/03 PHP
JavaScript中void(0)的具体含义解释
2007/02/27 Javascript
jQuery 开天辟地入门篇一
2009/12/09 Javascript
jQuery动画特效实例教程
2014/08/29 Javascript
jQuery插件AjaxFileUpload实现ajax文件上传
2016/05/05 Javascript
Angularjs 实现动态添加控件功能
2017/05/25 Javascript
JS 学习总结之正则表达式的懒惰性和贪婪性
2017/07/03 Javascript
JavaScript组合模式---引入案例分析
2020/05/23 Javascript
详解Vue 数据更新了但页面没有更新的 7 种情况汇总及延伸总结
2020/05/28 Javascript
全面解析js中的原型,原型对象,原型链
2021/01/25 Javascript
用Javascript实现发送短信验证码间隔功能
2021/02/08 Javascript
使用Python编写简单的画图板程序的示例教程
2015/12/08 Python
python中string模块各属性以及函数的用法介绍
2016/05/30 Python
Python常见排序操作示例【字典、列表、指定元素等】
2018/08/15 Python
Python OpenCV对本地视频文件进行分帧保存的实例
2019/01/08 Python
在Python中COM口的调用方法
2019/07/03 Python
对django 模型 unique together的示例讲解
2019/08/06 Python
Python3简单爬虫抓取网页图片代码实例
2019/08/26 Python
Python图像处理库PIL的ImageGrab模块介绍详解
2020/02/26 Python
Flask缓存静态文件的具体方法
2020/08/02 Python
通俗讲解python 装饰器
2020/09/07 Python
flask项目集成swagger的方法
2020/12/09 Python
四川internet信息高速公路(C#)笔试题
2012/02/29 面试题
毕业研究生的自我鉴定
2013/11/30 职场文书
养殖人员的创业计划书范文
2013/12/26 职场文书
大专会计自我鉴定
2014/02/06 职场文书
财务总监岗位职责
2014/03/07 职场文书
《每逢佳节倍思亲》教后反思
2014/04/19 职场文书
2014年社区教育工作总结
2014/12/02 职场文书
详解MindSpore自定义模型损失函数
2021/06/30 Python
Python日志模块logging用法
2022/06/05 Python