指纹解锁特效

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>指纹解锁特效</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background-color: #f5f5f5;
            margin: 0;
        }
        
        .fingerprint-container {
            position: relative;
            width: 200px;
            height: 200px;
            display: flex;
            flex-direction: column;
            align-items: center;
        }
        
        .fingerprint {
            width: 120px;
            height: 160px;
            background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><path d="M20,30 Q30,20 40,30 Q50,40 60,30 Q70,20 80,30" stroke="black" fill="none" stroke-width="2"/><path d="M25,50 Q35,40 45,50 Q55,60 65,50 Q75,40 85,50" stroke="black" fill="none" stroke-width="2"/><path d="M30,70 Q40,60 50,70 Q60,80 70,70" stroke="black" fill="none" stroke-width="2"/></svg>');
            background-repeat: no-repeat;
            background-position: center;
            position: relative;
        }
        
        .fingerprint::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 0;
            background-color: rgba(0, 150, 255, 0.3);
            transition: height 0.5s ease;
        }
        
        .fingerprint.active::after {
            height: 100%;
        }
        
        .status {
            margin-top: 20px;
            font-size: 14px;
            color: #666;
        }
        
        .success {
            color: green;
        }
        
        .error {
            color: red;
        }
        
        .fingerprint-btn {
            margin-top: 20px;
            padding: 8px 16px;
            background-color: #007bff;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        
        .fingerprint-btn:hover {
            background-color: #0069d9;
        }
    </style>
</head>
<body>
    <div class="fingerprint-container">
        <div class="fingerprint" id="fingerprint"></div>
        <div class="status" id="status">请将手指放在指纹传感器上</div>
        <button class="fingerprint-btn" id="scanBtn">开始扫描</button>
    </div>

    <script>
        const fingerprint = document.getElementById('fingerprint');
        const status = document.getElementById('status');
        const scanBtn = document.getElementById('scanBtn');
        
        // 模拟指纹扫描
        function simulateFingerprintScan() {
            status.textContent = "正在识别指纹...";
            status.className = "status";
            fingerprint.classList.add('active');
            
            // 随机模拟成功或失败
            setTimeout(() => {
                const isSuccess = Math.random() > 0.3;
                
                if (isSuccess) {
                    status.textContent = "指纹识别成功!";
                    status.className = "status success";
                    

                    
                    // 成功后3秒重置
                    setTimeout(resetScanner, 3000);
                } else {
                    status.textContent = "指纹识别失败,请重试";
                    status.className = "status error";
                    fingerprint.classList.remove('active');
                }
            }, 2000);
        }
        
        function resetScanner() {
            fingerprint.classList.remove('active');
            status.textContent = "请将手指放在指纹传感器上";
            status.className = "status";
        }
        
        scanBtn.addEventListener('click', simulateFingerprintScan);
        
        // 简单的指纹识别功能
        function getBrowserFingerprint() {
            const canvas = document.createElement('canvas');
            const ctx = canvas.getContext('2d');
            ctx.textBaseline = 'top';
            ctx.font = '14px Arial';
            ctx.fillStyle = '#f60';
            ctx.fillRect(125, 1, 62, 20);
            ctx.fillStyle = '#069';
            ctx.fillText('指纹识别', 2, 15);
            ctx.fillStyle = 'rgba(102, 204, 0, 0.7)';
            ctx.fillText('指纹识别', 4, 17);
            
            return canvas.toDataURL();
        }
        
        // 页面加载时获取浏览器指纹
        window.addEventListener('load', () => {
            const fingerprintData = getBrowserFingerprint();
            console.log('浏览器指纹数据:', fingerprintData);
        });
    </script>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值