<!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>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: #222;
overflow: hidden;
}
.gear-container {
position: relative;
width: 300px;
height: 300px;
display: flex;
justify-content: center;
align-items: center;
}
/* 齿轮基础样式 */
.gear {
position: absolute;
background-color: #444;
border-radius: 50%;
box-shadow: 0 0 10px rgba(0,0,0,0.5);
display: flex;
justify-content: center;
align-items: center;
}
/* 齿轮齿样式 */
.gear::before {
content: '';
position: absolute;
width: 100%;
height: 100%;
background:
repeating-conic-gradient(
from 0deg,
#555 0deg 20deg,
transparent 20deg 40deg
);
border-radius: 50%;
}
/* 中心孔 */
.gear::after {
content: '';
position: absolute;
width: 25%;
height: 25%;
background-color: #222;
border-radius: 50%;
box-shadow: inset 0 0 5px rgba(0,0,0,0.8);
}
/* 大齿轮 */
.gear-large {
width: 200px;
height: 200px;
animation: rotate 8s linear infinite;
}
/* 中齿轮 */
.gear-medium {
width: 140px;
height: 140px;
top: 180px;
left: 180px;
animation: rotate-reverse 6s linear infinite;
}
/* 小齿轮 */
.gear-small {
width: 80px;
height: 80px;
top: 50px;
left: 50px;
animation: rotate 4s linear infinite;
}
/* 旋转动画 */
@keyframes rotate {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@keyframes rotate-reverse {
from {
transform: rotate(0deg);
}
to {
transform: rotate(-360deg);
}
}
/* 连接杆 */
.connector {
position: absolute;
background-color: #555;
z-index: -1;
}
.connector-1 {
width: 120px;
height: 20px;
top: 90px;
left: 90px;
transform: rotate(45deg);
}
.connector-2 {
width: 120px;
height: 20px;
top: 90px;
left: 90px;
transform: rotate(-45deg);
}
/* 发光效果 */
.glow {
position: absolute;
width: 300px;
height: 300px;
border-radius: 50%;
background: radial-gradient(circle, rgba(100,200,255,0.2) 0%, transparent 70%);
filter: blur(10px);
animation: pulse 3s ease-in-out infinite alternate;
}
@keyframes pulse {
from {
opacity: 0.5;
transform: scale(0.9);
}
to {
opacity: 0.8;
transform: scale(1.1);
}
}
/* 标题样式 */
.title {
position: absolute;
bottom: 50px;
color: #eee;
font-family: Arial, sans-serif;
font-size: 24px;
text-shadow: 0 0 10px rgba(100,200,255,0.5);
opacity: 0;
animation: fadeIn 2s ease-in-out 1s forwards;
}
@keyframes fadeIn {
to {
opacity: 1;
}
}
</style>
</head>
<body>
<div class="gear-container">
<div class="glow"></div>
<div class="gear gear-large"></div>
<div class="gear gear-medium"></div>
<div class="gear gear-small"></div>
<div class="connector connector-1"></div>
<div class="connector connector-2"></div>
<div class="title">机械动力系统</div>
</div>
</body>
</html>
455

被折叠的 条评论
为什么被折叠?



