<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS3西洋镜动画特效</title>
<style>
body {
margin: 0;
padding: 0;
background: #000;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
overflow: hidden;
font-family: Arial, sans-serif;
}
.peep-box {
position: relative;
width: 300px;
height: 400px;
background: #111;
border-radius: 10px;
box-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
overflow: hidden;
}
.peep-hole {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 200px;
height: 200px;
border-radius: 50%;
background: #000;
box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
z-index: 10;
}
.image-strip {
position: absolute;
top: 0;
left: 0;
width: 1000px;
height: 100%;
background: url('https://a.88a.org.cn/aJxs') center/cover;
animation: slide 15s linear infinite;
}
.wood-texture {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect width="100" height="100" fill="%23a0522d"/><path d="M0,20 L100,20 M0,40 L100,40 M0,60 L100,60 M0,80 L100,80" stroke="%238B4513" stroke-width="1"/></svg>');
opacity: 0.3;
z-index: 5;
}
.stand {
position: absolute;
bottom: -50px;
left: 50%;
transform: translateX(-50%);
width: 60px;
height: 50px;
background: linear-gradient(to bottom, #8B4513, #A0522D);
border-radius: 0 0 5px 5px;
}
.stand:before {
content: '';
position: absolute;
top: -20px;
left: 50%;
transform: translateX(-50%);
width: 100px;
height: 20px;
background: linear-gradient(to bottom, #A0522D, #8B4513);
border-radius: 10px 10px 0 0;
}
@keyframes slide {
0% { transform: translateX(0); }
100% { transform: translateX(-700px); }
}
.title {
position: absolute;
bottom: 20px;
width: 100%;
text-align: center;
color: gold;
font-size: 14px;
text-shadow: 0 0 5px rgba(255, 215, 0, 0.7);
z-index: 20;
}
</style>
</head>
<body>
<div class="peep-box">
<div class="peep-hole"></div>
<div class="image-strip"></div>
<div class="wood-texture"></div>
<div class="stand"></div>
<div class="title">经典西洋镜效果 · CSS3动画</div>
</div>
</body>
</html>