js+css实时读取麦克风声音检测环境分贝声音检测仪代码

代码语言:html

所属分类:其他

代码描述:js+css实时读取麦克风声音检测环境分贝声音检测仪代码

代码标签: js css 麦克风 声音 检测 环境 分贝 检测仪 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!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>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #0c0c1d 0%, #1a1a3e 50%, #0c0c1d 100%);
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            color: #fff;
            overflow: hidden;
        }

        .container {
            text-align: center;
            padding: 40px;
            max-width: 600px;
            width: 100%;
        }

        h1 {
            font-size: 2rem;
            margin-bottom: 10px;
            background: linear-gradient(90deg, #00d2ff, #3a7bd5);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .subtitle {
            color: #8892b0;
            margin-bottom: 40px;
            font-size: 0.95rem;
        }

        /* 主圆形仪表盘 */
        .meter-container {
            position: relative;
            width: 280px;
            height: 280px;
            margin: 0 auto 40px;
        }

        .meter-ring {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
        }

        .meter-ring svg {
            width: 100%;
            height: 100%;
            transform: rotate(-90deg);
        }

        .meter-bg {
            fill: none;
            stroke: #1e2a4a;
            stroke-width: 12;
        }

        .meter-fill {
            fill: none;
            stroke: url(#gradient);
            stroke-width: 12;
            stroke-linecap: round;
            stroke-dasharray: 754;
            stroke-dashoffset: 754;
            transition: stroke-dashoffset 0.1s ease;
        }

        .meter-inner {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            text-align: center;
        }

        .db-value {
            font-size: 4rem;
            font-weight: 700;
            line-height: 1;
            color: #fff;
            text-shadow: 0 0 30px rgba(0, 210, 255, 0.3);
        }

        .db-unit {
            font-size: 1.2rem;
            color: #8892b0;
            margin-top: 5px;
        }

        .db-label {
            font-size: 1rem;
            margin-top: 8px;
            padding: 4px 16px;
            border-radius: 20px;
            display: inline-block;
            font-weight: 600;
            transition: all 0.3s ease;
        }

        /* 波形可视化 */
        .waveform-container {
            width: 100%;
            height: 80px;
            margin-bottom: 30px;
         .........完整代码请登录后点击上方下载按钮下载查看

网友评论0