js+css实现反射摄像头镜面反光按钮ui布局效果代码
代码语言:html
所属分类:布局界面
代码描述:js+css实现反射摄像头镜面反光按钮ui布局效果代码,将摄像头画面放在按钮中,模拟金属材质反射。
代码标签: js css 反射 摄像头 镜面 反光 按钮 ui 布局
下面为部分代码预览,完整代码请点击下载或在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 {
min-height: 100vh;
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
overflow-x: hidden;
padding: 40px 20px;
}
h1 {
color: #fff;
margin-bottom: 20px;
font-weight: 300;
text-align: center;
text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.subtitle {
color: rgba(255,255,255,0.6);
margin-bottom: 50px;
font-size: 14px;
}
/* 摄像头预览 */
.camera-container {
position: fixed;
top: 20px;
right: 20px;
width: 180px;
height: 135px;
border-radius: 12px;
overflow: hidden;
border: 2px solid rgba(255,255,255,0.2);
box-shadow: 0 10px 40px rgba(0,0,0,0.3);
z-index: 100;
}
#video {
width: 100%;
height: 100%;
object-fit: cover;
transform: scaleX(-1);
}
.camera-label {
position: absolute;
bottom: 8px;
left: 8px;
background: rgba(0,0,0,0.6);
color: #fff;
padding: 4px 8px;
border-radius: 4px;
font-size: 10px;
}
/* 隐藏的canvas用于处理 */
#reflectionCanvas {
display: none;
}
/* 按钮容器 */
.button-showcase {
display: flex;
flex-wrap: wrap;
gap: 40px;
justify-content: center;
align-items: center;
max-width: 1200px;
}
.button-group {
display: flex;
flex-direction: column;
align-items: center;
gap: 15px;
}
.button-label {
color: rgba(255,255,255,0.5);
font-size: 12px;
text-transform: uppercase;
letter-spacing: 2px;
}
/* 基础不锈钢按钮样式 */
.steel-button {
position: relative;
border: none;
cursor: pointer;
font-family: inherit;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 2px;
overflow: hidden;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
-webkit-tap-highlight-color: transparent;
.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0