<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>鼠标拖尾特效</title>
<style>
body {
margin: 0;
overflow: hidden;
background-color: #282c34;
}
.trail {
position: absolute;
width: 10px;
height: 10px;
border-radius: 50%;
background-color: #ff4081;
pointer-events: none;
animation: trailEffect 0.5s forwards;
}
@keyframes trailEffect {
0% {
transform: scale(1);
opacity: 1;
}
100% {
transform: scale(0);
opacity: 0;
}
}
.trail {
position: absolute;
width: 12px;
height: 12px;
border-radius: 50%;
background-color: #ff4081;
pointer-events: none;
animation: trailEffect 0.6s forwards;
box-shadow: 0 0 10px rgba(255, 64, 129, 0.8);
}
@keyframes trailEffect {
0% {
transform: scale(1);
opacity: 1;
background-color: #ff4081;
}
100% {
transform: scale(0);
opacity: 0;
background-color: #ff80ab;
}
}
</style>
</head>
<body>
<script src="main.js"></script>
</body>
</html>
index.html
main.js
index.html