js实现控制手机摄像头散光灯补光灯开关代码
代码语言:html
所属分类:其他
代码描述:js实现控制手机摄像头散光灯补光灯开关代码,需要在https下运行打开。
代码标签: js 控制 手机 摄像头 散光灯 补光灯 开关 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, viewport-fit=cover">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="theme-color" content="#0a0a0a">
<title>手电筒</title>
<style>
:root {
--bg: #0a0a0a;
--bg-light: #1a1a1a;
--text: #e0e0e0;
--text-dim: #888;
--accent-off: #3a3a3a;
--accent-on: #ffb300;
--glow-on: rgba(255, 179, 0, 0.6);
--glow-strong: rgba(255, 200, 50, 0.9);
--danger: #e57373;
--success: #81c784;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
-webkit-tap-highlight-color: transparent;
-webkit-user-select: none;
user-select: none;
-webkit-touch-callout: none;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Helvetica Neue', sans-serif;
background: var(--bg);
color: var(--text);
min-height: 100vh;
min-height: 100dvh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
overflow: hidden;
transition: background 0.8s ease;
position: relative;
}
/* 环境光模拟 - 手电筒开启时背景微微变暖 */
body.torch-on {
background: #11100a;
}
/* 环境光晕 */
.ambient-glow {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 300px;
height: 300px;
border-radius: 50%;
pointer-events: none;
background: radial-gradient(circle, rgba(255, 179, 0, 0.08) 0%, rgba(255, 179, 0, 0.03) 40%, transparent 70%);
opacity: 0;
transition: opacity 0.6s ease;
z-index: 0;
}
body.torch-on .ambient-glow {
opacity: 1;
animation: ambientPulse 2.5s ease-in-out infinite;
}
@keyframes ambientPulse {
0%,
100% {
transform: translate(-50%, -50%) scale(1);
opacity: 0.7;
}
50% {
transform: translate(-50%, -50%) scale(1.3);
opacity: 1;
}
}
/* 主容器 */
.container {
position: relative;
z-index: 1;
display: flex;
flex-direction: column;
align-items: center;
gap: 30px;
padding: 20px;
}
/* 状.........完整代码请登录后点击上方下载按钮下载查看















网友评论0