<!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 {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: linear-gradient(to bottom, #1a1a2e, #16213e);
margin: 0;
font-family: Arial, sans-serif;
overflow: hidden;
}
.match-container {
position: relative;
width: 300px;
height: 400px;
display: flex;
flex-direction: column;
align-items: center;
}
.match {
position: relative;
width: 8px;
height: 200px;
background: linear-gradient(to bottom, #d4a76a, #b58c4f);
border-radius: 4px;
z-index: 2;
transform: rotate(-5deg);
box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
}
.match-head {
position: absolute;
top: -20px;
left: -8px;
width: 24px;
height: 24px;
background: linear-gradient(to bottom, #ff6b00, #ff9a00);
border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
z-index: 3;
box-shadow: 0 0 10px rgba(255,100,0,0.5);
animation: burn 3s infinite alternate;
}
.flame {
position: absolute;
top: -60px;
left: -5px;
width: 30px;
height: 80px;
background: linear-gradient(to top, rgba(255,200,0,0),
rgba(255,150,0,0.8),
rgba(255,100,0,0.8),
rgba(255,50,0,0.6));
border-radius: 50% 50% 20% 20%;
filter: blur(5px);
transform-origin: center bottom;
animation: flicker 0.5s infinite alternate,
flame-sway 2s infinite ease-in-out;
z-index: 1;
}
.sparks {
position: absolute;
top: -80px;
left: 0;
width: 100%;
height: 100px;
z-index: 4;
}
.spark {
position: absolute;
width: 3px;
height: 3px;
background: #ff9a00;
border-radius: 50%;
opacity: 0;
animation: spark-fly 2s infinite;
}
.spark:nth-child(1) {
top: 10px;
left: 5px;
animation-delay: 0.2s;
}
.spark:nth-child(2) {
top: 5px;
left: 15px;
animation-delay: 0.5s;
}
.spark:nth-child(3) {
top: 15px;
left: 10px;
animation-delay: 0.8s;
}
.spark:nth-child(4) {
top: 8px;
left: 20px;
animation-delay: 1.1s;
}
.spark:nth-child(5) {
top: 20px;
left: 5px;
animation-delay: 1.4s;
}
.shadow {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 150px;
height: 20px;
background: radial-gradient(ellipse at center, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0) 70%);
border-radius: 50%;
z-index: 1;
}
@keyframes burn {
0%, 100% {
transform: scale(1);
box-shadow: 0 0 10px rgba(255,100,0,0.5);
}
50% {
transform: scale(0.95);
box-shadow: 0 0 15px rgba(255,100,0,0.8);
}
}
@keyframes flicker {
0%, 100% {
height: 80px;
opacity: 0.9;
}
25% {
height: 90px;
opacity: 1;
}
50% {
height: 70px;
opacity: 0.8;
}
75% {
height: 85px;
opacity: 0.95;
}
}
@keyframes flame-sway {
0%, 100% {
transform: rotate(-5deg);
}
50% {
transform: rotate(5deg);
}
}
@keyframes spark-fly {
0% {
transform: translateY(0) translateX(0);
opacity: 1;
}
100% {
transform: translateY(-50px) translateX(10px);
opacity: 0;
}
}
/* 插入的链接样式 */
.custom-link {
position: fixed;
bottom: 20px;
right: 20px;
color: rgba(255,255,255,0.7);
text-decoration: none;
font-size: 14px;
background: rgba(0,0,0,0.3);
padding: 8px 15px;
border-radius: 20px;
transition: all 0.3s ease;
}
.custom-link:hover {
color: white;
background: rgba(0,0,0,0.5);
}
</style>
</head>
<body>
<div class="match-container">
<div class="match">
<div class="match-head"></div>
<div class="flame"></div>
<div class="sparks">
<div class="spark"></div>
<div class="spark"></div>
<div class="spark"></div>
<div class="spark"></div>
<div class="spark"></div>
</div>
</div>
<div class="shadow"></div>
</div>
</body>
</html>