<!DOCTYPE html>
<html lang="zh">
<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;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: #f0f0f0;
font-family: Arial, sans-serif;
overflow: hidden;
}
.washing-machine {
position: relative;
width: 300px;
height: 400px;
background: #e0e0e0;
border-radius: 20px;
box-shadow:
0 10px 20px rgba(0,0,0,0.2),
inset 0 -5px 15px rgba(0,0,0,0.1);
}
.machine-body {
position: absolute;
top: 20px;
left: 20px;
right: 20px;
bottom: 20px;
background: #f8f8f8;
border-radius: 15px;
overflow: hidden;
box-shadow:
inset 0 5px 15px rgba(255,255,255,0.8),
inset 0 -5px 15px rgba(0,0,0,0.1);
}
.door {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 180px;
height: 180px;
background: #333;
border-radius: 50%;
box-shadow:
inset 0 0 30px rgba(0,0,0,0.8),
0 5px 15px rgba(0,0,0,0.3);
z-index: 2;
}
.door-window {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 150px;
height: 150px;
background: #a0d8f3;
border-radius: 50%;
box-shadow:
inset 0 0 30px rgba(0,0,0,0.3),
0 0 10px rgba(160, 216, 243, 0.8);
overflow: hidden;
}
.drum {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 140px;
height: 140px;
border-radius: 50%;
background: rgba(255,255,255,0.1);
border: 2px dashed rgba(255,255,255,0.3);
animation: rotate 5s linear infinite;
}
.clothes {
position: absolute;
background: #fff;
opacity: 0.8;
border-radius: 3px;
animation: clothes-move 8s linear infinite;
}
.clothes1 {
width: 30px;
height: 20px;
top: 30%;
left: 40%;
animation-delay: 0s;
}
.clothes2 {
width: 25px;
height: 15px;
top: 60%;
left: 30%;
animation-delay: 1s;
}
.clothes3 {
width: 20px;
height: 25px;
top: 45%;
left: 60%;
animation-delay: 2s;
}
.clothes4 {
width: 15px;
height: 20px;
top: 25%;
left: 70%;
animation-delay: 3s;
}
.clothes5 {
width: 25px;
height: 15px;
top: 70%;
left: 60%;
animation-delay: 4s;
}
@keyframes rotate {
0% { transform: translate(-50%, -50%) rotate(0deg); }
100% { transform: translate(-50%, -50%) rotate(360deg); }
}
@keyframes clothes-move {
0% { transform: rotate(0deg) translateX(0); }
25% { transform: rotate(90deg) translateX(20px); }
50% { transform: rotate(180deg) translateX(0); }
75% { transform: rotate(270deg) translateX(-20px); }
100% { transform: rotate(360deg) translateX(0); }
}
.control-panel {
position: absolute;
bottom: 30px;
left: 50%;
transform: translateX(-50%);
width: 200px;
height: 60px;
background: #d0d0d0;
border-radius: 10px;
display: flex;
justify-content: space-around;
align-items: center;
box-shadow:
inset 0 2px 5px rgba(255,255,255,0.8),
inset 0 -2px 5px rgba(0,0,0,0.2);
}
.button {
width: 30px;
height: 30px;
background: #555;
border-radius: 50%;
box-shadow:
0 2px 5px rgba(0,0,0,0.3),
inset 0 -2px 5px rgba(0,0,0,0.5),
inset 0 2px 5px rgba(255,255,255,0.1);
}
.display {
width: 80px;
height: 30px;
background: #333;
border-radius: 5px;
display: flex;
justify-content: center;
align-items: center;
color: #0f0;
font-size: 12px;
font-weight: bold;
text-shadow: 0 0 5px #0f0;
box-shadow:
inset 0 0 10px rgba(0,255,0,0.5);
}
.brand {
position: absolute;
top: 25px;
left: 50%;
transform: translateX(-50%);
color: #333;
font-weight: bold;
font-size: 18px;
text-shadow: 0 1px 1px rgba(255,255,255,0.8);
}
.link-container {
position: absolute;
bottom: 10px;
right: 10px;
background: rgba(255, 255, 255, 0.7);
padding: 5px 10px;
border-radius: 5px;
}
.link-container a {
color: #2196F3;
text-decoration: none;
font-size: 12px;
}
</style>
</head>
<body>
<div class="washing-machine">
<div class="brand">CSS WASH</div>
<div class="machine-body">
<div class="door">
<div class="door-window">
<div class="drum">
<div class="clothes clothes1"></div>
<div class="clothes clothes2"></div>
<div class="clothes clothes3"></div>
<div class="clothes clothes4"></div>
<div class="clothes clothes5"></div>
</div>
</div>
</div>
<div class="control-panel">
<div class="button"></div>
<div class="display">WASHING</div>
<div class="button"></div>
</div>
</div>
<div class="link-container">
</div>
</div>
</body>
</html>
CSS3实现滚筒洗衣机动画
2655

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



