<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>梦幻鼠标特效组合</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
min-height: 100vh;
overflow: hidden;
font-family: 'Arial', sans-serif;
cursor: none;
}
.content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
color: white;
z-index: 100;
max-width: 800px;
padding: 30px;
background: rgba(10, 15, 35, 0.7);
border-radius: 20px;
box-shadow: 0 0 30px rgba(0, 100, 255, 0.3);
backdrop-filter: blur(5px);
border: 1px solid rgba(100, 150, 255, 0.3);
}
h1 {
font-size: 3rem;
margin-bottom: 20px;
background: linear-gradient(to right, #ffd700, #ffa500, #ff8c00);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
text-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}
p {
font-size: 1.2rem;
margin-bottom: 30px;
line-height: 1.6;
color: #e0e0ff;
}
.link-btn {
display: inline-block;
padding: 12px 30px;
background: linear-gradient(45deg, #ff8a00, #e52e71);
color: white;
text-decoration: none;
border-radius: 50px;
font-weight: bold;
font-size: 1.1rem;
transition: all 0.3s ease;
box-shadow: 0 5px 15px rgba(255, 138, 0, 0.4);
}
.link-btn:hover {
transform: translateY(-3px);
box-shadow: 0 8px 25px rgba(255, 138, 0, 0.6);
}
.footer {
position: fixed;
bottom: 20px;
width: 100%;
text-align: center;
color: rgba(255, 255, 255, 0.5);
font-size: 0.9rem;
z-index: 100;
}
.footer a {
color: rgba(255, 255, 255, 0.8);
text-decoration: none;
}
.footer a:hover {
color: white;
text-decoration: underline;
}
/* 笑脸跟随样式 */
.smiley {
position: absolute;
pointer-events: none;
font-size: 30px;
z-index: 50;
transform: translate(-50%, -50%);
transition: transform 0.1s ease-out;
text-shadow: 0 0 10px rgba(255, 255, 0, 0.7);
}
/* 仙女棒粒子样式 */
.fairy-particle {
position: absolute;
border-radius: 50%;
pointer-events: none;
transform: translate(-50%, -50%);
mix-blend-mode: screen;
transition: transform 0.1s ease-out;
}
/* 泡泡样式 */
.bubble {
position: absolute;
border-radius: 50%;
background: rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.3);
pointer-events: none;
animation: float-up 15s infinite linear;
}
@keyframes float-up {
0% {
transform: translateY(0) rotate(0deg);
opacity: 0;
}
10% {
opacity: 0.5;
}
90% {
opacity: 0.5;
}
100% {
transform: translateY(-100vh) rotate(360deg);
opacity: 0;
}
}
/* 雪花样式 */
.snowflake {
position: absolute;
color: white;
pointer-events: none;
user-select: none;
animation: snow-fall linear infinite;
}
@keyframes snow-fall {
0% {
transform: translateY(-10vh) rotate(0deg);
opacity: 0;
}
10% {
opacity: 1;
}
90% {
opacity: 1;
}
100% {
transform: translateY(100vh) rotate(360deg);
opacity: 0;
}
}
/* 点击烟花样式 */
.firework {
position: absolute;
pointer-events: none;
transform: translate(-50%, -50%);
animation: firework-explode 1s ease-out forwards;
opacity: 0.8;
}
@keyframes firework-explode {
0% {
transform: translate(-50%, -50%) scale(0);
opacity: 1;
}
100% {
transform: translate(-50%, -50%) scale(1.5);
opacity: 0;
}
}
.firework-particle {
position: absolute;
border-radius: 50%;
animation: firework-particle 1s ease-out forwards;
}
@keyframes firework-particle {
0% {
transform: translate(0, 0) scale(1);
opacity: 1;
}
100% {
transform: translate(var(--tx), var(--ty)) scale(0);
opacity: 0;
}
}
</style>
</head>
<body>
<div class="content">
<h1>梦幻鼠标特效组合</h1>
<p>体验笑脸跟随、仙女棒拖尾、漂浮泡泡、飘落雪花和点击烟花五种特效的完美组合!</p>
</div>
<div class="footer">
</div>
<script>
// 鼠标笑脸跟随
const smiley = document.createElement('div');
smiley.className = 'smiley';
smiley.innerHTML = '😊';
document.body.appendChild(smiley);
// 仙女棒粒子系统
class FairyParticleSystem {
constructor() {
this.particles = [];
this.particleCount = 20;
this.mouseX = window.innerWidth / 2;
this.mouseY = window.innerHeight / 2;
this.init();
}
init() {
for (let i = 0; i < this.particleCount; i++) {
this.createParticle(i);
}
document.addEventListener('mousemove', (e) => {
this.mouseX = e.clientX;
this.mouseY = e.clientY;
});
this.animate();
}
createParticle(index) {
const particle = document.createElement('div');
particle.className = 'fairy-particle';
document.body.appendChild(particle);
this.particles.push({
element: particle,
x: this.mouseX,
y: this.mouseY,
size: Math.random() * 10 + 5,
color: this.getRandomColor(),
delay: index * 0.03,
speed: Math.random() * 0.2 + 0.05
});
}
getRandomColor() {
const hue = Math.floor(Math.random() * 60) + 30; // 暖色调
return `hsl(${hue}, 100%, 70%)`;
}
animate() {
this.particles.forEach((particle, index) => {
const delayFactor = 1 - (particle.delay * 2);
const targetX = this.mouseX;
const targetY = this.mouseY;
particle.x += (targetX - particle.x) * particle.speed * delayFactor;
particle.y += (targetY - particle.y) * particle.speed * delayFactor;
particle.element.style.left = `${particle.x}px`;
particle.element.style.top = `${particle.y}px`;
particle.element.style.width = `${particle.size * delayFactor}px`;
particle.element.style.height = `${particle.size * delayFactor}px`;
particle.element.style.backgroundColor = particle.color;
particle.element.style.opacity = delayFactor * 0.8;
particle.element.style.filter = `blur(${2 * (1 - delayFactor)}px)`;
});
requestAnimationFrame(() => this.animate());
}
}
// 泡泡系统
function createBubbles() {
const bubbleCount = 20;
for (let i = 0; i < bubbleCount; i++) {
const bubble = document.createElement('div');
bubble.className = 'bubble';
const size = Math.random() * 30 + 10;
bubble.style.width = `${size}px`;
bubble.style.height = `${size}px`;
bubble.style.left = `${Math.random() * 100}%`;
bubble.style.bottom = `-${size}px`;
bubble.style.animationDuration = `${Math.random() * 10 + 10}s`;
bubble.style.animationDelay = `${Math.random() * 5}s`;
document.body.appendChild(bubble);
}
}
// 雪花系统
function createSnowflakes() {
const snowflakeCount = 50;
const snowflakes = ['❄', '❅', '❆', '✻', '✼'];
for (let i = 0; i < snowflakeCount; i++) {
const snowflake = document.createElement('div');
snowflake.className = 'snowflake';
snowflake.textContent = snowflakes[Math.floor(Math.random() * snowflakes.length)];
const size = Math.random() * 20 + 10;
snowflake.style.fontSize = `${size}px`;
snowflake.style.left = `${Math.random() * 100}%`;
snowflake.style.top = `-${size}px`;
snowflake.style.animationDuration = `${Math.random() * 10 + 5}s`;
snowflake.style.animationDelay = `${Math.random() * 5}s`;
snowflake.style.opacity = Math.random() * 0.5 + 0.3;
document.body.appendChild(snowflake);
}
}
// 点击烟花系统
function createFirework(x, y) {
const firework = document.createElement('div');
firework.className = 'firework';
firework.style.left = `${x}px`;
firework.style.top = `${y}px`;
const particleCount = 30;
const color = `hsl(${Math.floor(Math.random() * 360)}, 100%, 70%)`;
for (let i = 0; i < particleCount; i++) {
const angle = (i / particleCount) * Math.PI * 2;
const distance = Math.random() * 50 + 50;
const tx = Math.cos(angle) * distance;
const ty = Math.sin(angle) * distance;
const particle = document.createElement('div');
particle.className = 'firework-particle';
particle.style.left = '50%';
particle.style.top = '50%';
particle.style.width = '8px';
particle.style.height = '8px';
particle.style.backgroundColor = color;
particle.style.setProperty('--tx', `${tx}px`);
particle.style.setProperty('--ty', `${ty}px`);
particle.style.animationDelay = `${Math.random() * 0.2}s`;
firework.appendChild(particle);
}
document.body.appendChild(firework);
setTimeout(() => {
firework.remove();
}, 1000);
}
// 初始化所有特效
window.addEventListener('load', () => {
// 笑脸跟随
document.addEventListener('mousemove', (e) => {
smiley.style.left = `${e.clientX + 20}px`;
smiley.style.top = `${e.clientY + 20}px`;
});
// 仙女棒
new FairyParticleSystem();
// 泡泡
createBubbles();
// 雪花
createSnowflakes();
// 点击烟花
document.addEventListener('click', (e) => {
createFirework(e.clientX, e.clientY);
});
});
</script>
</body>
</html>
286

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



