Spaces:
Running
Running
Add 3 files
Browse files- README.md +7 -5
- index.html +309 -19
- prompts.txt +1 -0
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: mouseanimation-deepsite
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: gray
|
| 5 |
+
colorTo: green
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,309 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Interactive Particle Playground</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<style>
|
| 9 |
+
body {
|
| 10 |
+
margin: 0;
|
| 11 |
+
padding: 0;
|
| 12 |
+
overflow: hidden;
|
| 13 |
+
background-color: #0f172a;
|
| 14 |
+
cursor: none;
|
| 15 |
+
touch-action: none;
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
.particle {
|
| 19 |
+
position: absolute;
|
| 20 |
+
border-radius: 50%;
|
| 21 |
+
pointer-events: none;
|
| 22 |
+
transform: translate(-50%, -50%);
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
.character {
|
| 26 |
+
position: absolute;
|
| 27 |
+
font-weight: bold;
|
| 28 |
+
pointer-events: none;
|
| 29 |
+
transform: translate(-50%, -50%);
|
| 30 |
+
font-family: 'Arial', sans-serif;
|
| 31 |
+
text-shadow: 0 0 5px rgba(255,255,255,0.7);
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
.explosion {
|
| 35 |
+
position: absolute;
|
| 36 |
+
pointer-events: none;
|
| 37 |
+
transform: translate(-50%, -50%);
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
.star {
|
| 41 |
+
position: absolute;
|
| 42 |
+
width: 0;
|
| 43 |
+
height: 0;
|
| 44 |
+
border-left: 5px solid transparent;
|
| 45 |
+
border-right: 5px solid transparent;
|
| 46 |
+
border-bottom: 10px solid;
|
| 47 |
+
transform-origin: 50% 0;
|
| 48 |
+
opacity: 0.8;
|
| 49 |
+
}
|
| 50 |
+
</style>
|
| 51 |
+
</head>
|
| 52 |
+
<body class="w-full h-screen">
|
| 53 |
+
<div id="particles"></div>
|
| 54 |
+
<div id="characters"></div>
|
| 55 |
+
<div id="explosions"></div>
|
| 56 |
+
|
| 57 |
+
<script>
|
| 58 |
+
// 鼠标拖尾效果
|
| 59 |
+
const particlesContainer = document.getElementById('particles');
|
| 60 |
+
const charactersContainer = document.getElementById('characters');
|
| 61 |
+
const explosionsContainer = document.getElementById('explosions');
|
| 62 |
+
|
| 63 |
+
let mouseX = 0;
|
| 64 |
+
let mouseY = 0;
|
| 65 |
+
let particles = [];
|
| 66 |
+
let characters = [];
|
| 67 |
+
let explosions = [];
|
| 68 |
+
|
| 69 |
+
// 可映射的按键字符
|
| 70 |
+
const validChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+-=[]{}|;':\",./<>?`~";
|
| 71 |
+
|
| 72 |
+
// 颜色数组
|
| 73 |
+
const colors = [
|
| 74 |
+
'#FF5252', '#FF4081', '#E040FB', '#7C4DFF',
|
| 75 |
+
'#536DFE', '#448AFF', '#40C4FF', '#18FFFF',
|
| 76 |
+
'#64FFDA', '#69F0AE', '#B2FF59', '#EEFF41',
|
| 77 |
+
'#FFFF00', '#FFD740', '#FFAB40', '#FF6E40'
|
| 78 |
+
];
|
| 79 |
+
|
| 80 |
+
// 跟踪鼠标位置
|
| 81 |
+
document.addEventListener('mousemove', (e) => {
|
| 82 |
+
mouseX = e.clientX;
|
| 83 |
+
mouseY = e.clientY;
|
| 84 |
+
createParticleTrail();
|
| 85 |
+
});
|
| 86 |
+
|
| 87 |
+
// 鼠标左键点击 - 圆形爆炸
|
| 88 |
+
document.addEventListener('mousedown', (e) => {
|
| 89 |
+
if (e.button === 0) { // 左键
|
| 90 |
+
createExplosion(e.clientX, e.clientY, 'circle');
|
| 91 |
+
} else if (e.button === 2) { // 右键
|
| 92 |
+
createExplosion(e.clientX, e.clientY, 'star');
|
| 93 |
+
}
|
| 94 |
+
});
|
| 95 |
+
|
| 96 |
+
// 阻止右键菜单
|
| 97 |
+
document.addEventListener('contextmenu', (e) => {
|
| 98 |
+
e.preventDefault();
|
| 99 |
+
});
|
| 100 |
+
|
| 101 |
+
// 键盘按键事件
|
| 102 |
+
document.addEventListener('keydown', (e) => {
|
| 103 |
+
if (validChars.includes(e.key)) {
|
| 104 |
+
createCharacter(e.key);
|
| 105 |
+
}
|
| 106 |
+
});
|
| 107 |
+
|
| 108 |
+
// 创建拖尾粒子
|
| 109 |
+
function createParticleTrail() {
|
| 110 |
+
const particle = document.createElement('div');
|
| 111 |
+
particle.className = 'particle';
|
| 112 |
+
|
| 113 |
+
const size = Math.random() * 5 + 2;
|
| 114 |
+
const color = colors[Math.floor(Math.random() * colors.length)];
|
| 115 |
+
|
| 116 |
+
particle.style.width = `${size}px`;
|
| 117 |
+
particle.style.height = `${size}px`;
|
| 118 |
+
particle.style.backgroundColor = color;
|
| 119 |
+
particle.style.left = `${mouseX}px`;
|
| 120 |
+
particle.style.top = `${mouseY}px`;
|
| 121 |
+
|
| 122 |
+
particlesContainer.appendChild(particle);
|
| 123 |
+
|
| 124 |
+
particles.push({
|
| 125 |
+
element: particle,
|
| 126 |
+
x: mouseX,
|
| 127 |
+
y: mouseY,
|
| 128 |
+
size: size,
|
| 129 |
+
color: color,
|
| 130 |
+
life: 100,
|
| 131 |
+
speedX: Math.random() * 4 - 2,
|
| 132 |
+
speedY: Math.random() * 4 - 2
|
| 133 |
+
});
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
// 创建字符抛射
|
| 137 |
+
function createCharacter(char) {
|
| 138 |
+
const character = document.createElement('div');
|
| 139 |
+
character.className = 'character';
|
| 140 |
+
character.textContent = char;
|
| 141 |
+
|
| 142 |
+
const startX = Math.random() * window.innerWidth;
|
| 143 |
+
const color = colors[Math.floor(Math.random() * colors.length)];
|
| 144 |
+
const size = Math.random() * 20 + 20;
|
| 145 |
+
|
| 146 |
+
character.style.color = color;
|
| 147 |
+
character.style.fontSize = `${size}px`;
|
| 148 |
+
character.style.left = `${startX}px`;
|
| 149 |
+
character.style.top = `${window.innerHeight}px`;
|
| 150 |
+
|
| 151 |
+
charactersContainer.appendChild(character);
|
| 152 |
+
|
| 153 |
+
// 抛物线参数
|
| 154 |
+
const gravity = 0.2;
|
| 155 |
+
const initialSpeed = -10 - Math.random() * 10;
|
| 156 |
+
const horizontalSpeed = Math.random() * 4 - 2;
|
| 157 |
+
|
| 158 |
+
characters.push({
|
| 159 |
+
element: character,
|
| 160 |
+
x: startX,
|
| 161 |
+
y: window.innerHeight,
|
| 162 |
+
speedX: horizontalSpeed,
|
| 163 |
+
speedY: initialSpeed,
|
| 164 |
+
gravity: gravity,
|
| 165 |
+
rotation: 0,
|
| 166 |
+
rotationSpeed: Math.random() * 4 - 2,
|
| 167 |
+
opacity: 1,
|
| 168 |
+
life: 100
|
| 169 |
+
});
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
// 创建爆炸效果
|
| 173 |
+
function createExplosion(x, y, type) {
|
| 174 |
+
const explosion = document.createElement('div');
|
| 175 |
+
explosion.className = 'explosion';
|
| 176 |
+
explosion.style.left = `${x}px`;
|
| 177 |
+
explosion.style.top = `${y}px`;
|
| 178 |
+
|
| 179 |
+
explosionsContainer.appendChild(explosion);
|
| 180 |
+
|
| 181 |
+
const particleCount = type === 'circle' ? 30 : 10;
|
| 182 |
+
const explosionParticles = [];
|
| 183 |
+
|
| 184 |
+
for (let i = 0; i < particleCount; i++) {
|
| 185 |
+
if (type === 'circle') {
|
| 186 |
+
const particle = document.createElement('div');
|
| 187 |
+
particle.className = 'particle';
|
| 188 |
+
|
| 189 |
+
const size = Math.random() * 8 + 2;
|
| 190 |
+
const color = colors[Math.floor(Math.random() * colors.length)];
|
| 191 |
+
|
| 192 |
+
particle.style.width = `${size}px`;
|
| 193 |
+
particle.style.height = `${size}px`;
|
| 194 |
+
particle.style.backgroundColor = color;
|
| 195 |
+
|
| 196 |
+
explosion.appendChild(particle);
|
| 197 |
+
|
| 198 |
+
explosionParticles.push({
|
| 199 |
+
element: particle,
|
| 200 |
+
x: 0,
|
| 201 |
+
y: 0,
|
| 202 |
+
size: size,
|
| 203 |
+
color: color,
|
| 204 |
+
speedX: Math.random() * 10 - 5,
|
| 205 |
+
speedY: Math.random() * 10 - 5,
|
| 206 |
+
life: 50 + Math.random() * 50
|
| 207 |
+
});
|
| 208 |
+
} else { // star
|
| 209 |
+
const star = document.createElement('div');
|
| 210 |
+
star.className = 'star';
|
| 211 |
+
|
| 212 |
+
const color = colors[Math.floor(Math.random() * colors.length)];
|
| 213 |
+
const points = 5;
|
| 214 |
+
const rotation = (360 / points) * i;
|
| 215 |
+
|
| 216 |
+
star.style.borderBottomColor = color;
|
| 217 |
+
star.style.transform = `translate(-50%, -50%) rotate(${rotation}deg)`;
|
| 218 |
+
|
| 219 |
+
explosion.appendChild(star);
|
| 220 |
+
|
| 221 |
+
explosionParticles.push({
|
| 222 |
+
element: star,
|
| 223 |
+
x: 0,
|
| 224 |
+
y: 0,
|
| 225 |
+
speedX: Math.cos(rotation * Math.PI / 180) * (3 + Math.random() * 3),
|
| 226 |
+
speedY: Math.sin(rotation * Math.PI / 180) * (3 + Math.random() * 3),
|
| 227 |
+
life: 70 + Math.random() * 30,
|
| 228 |
+
rotation: rotation
|
| 229 |
+
});
|
| 230 |
+
}
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
explosions.push({
|
| 234 |
+
element: explosion,
|
| 235 |
+
particles: explosionParticles,
|
| 236 |
+
x: x,
|
| 237 |
+
y: y,
|
| 238 |
+
life: 100
|
| 239 |
+
});
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
// 动画循环
|
| 243 |
+
function animate() {
|
| 244 |
+
// 更新拖尾粒子
|
| 245 |
+
for (let i = particles.length - 1; i >= 0; i--) {
|
| 246 |
+
const p = particles[i];
|
| 247 |
+
p.life--;
|
| 248 |
+
p.x += p.speedX;
|
| 249 |
+
p.y += p.speedY;
|
| 250 |
+
|
| 251 |
+
p.element.style.left = `${p.x}px`;
|
| 252 |
+
p.element.style.top = `${p.y}px`;
|
| 253 |
+
p.element.style.opacity = p.life / 100;
|
| 254 |
+
|
| 255 |
+
if (p.life <= 0) {
|
| 256 |
+
p.element.remove();
|
| 257 |
+
particles.splice(i, 1);
|
| 258 |
+
}
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
// 更新字符抛射
|
| 262 |
+
for (let i = characters.length - 1; i >= 0; i--) {
|
| 263 |
+
const c = characters[i];
|
| 264 |
+
c.life--;
|
| 265 |
+
c.speedY += c.gravity;
|
| 266 |
+
c.x += c.speedX;
|
| 267 |
+
c.y += c.speedY;
|
| 268 |
+
c.rotation += c.rotationSpeed;
|
| 269 |
+
c.opacity = c.life / 100;
|
| 270 |
+
|
| 271 |
+
c.element.style.left = `${c.x}px`;
|
| 272 |
+
c.element.style.top = `${c.y}px`;
|
| 273 |
+
c.element.style.transform = `translate(-50%, -50%) rotate(${c.rotation}deg)`;
|
| 274 |
+
c.element.style.opacity = c.opacity;
|
| 275 |
+
|
| 276 |
+
if (c.y > window.innerHeight + 100 || c.life <= 0) {
|
| 277 |
+
c.element.remove();
|
| 278 |
+
characters.splice(i, 1);
|
| 279 |
+
}
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
// 更新爆炸效果
|
| 283 |
+
for (let i = explosions.length - 1; i >= 0; i--) {
|
| 284 |
+
const e = explosions[i];
|
| 285 |
+
e.life--;
|
| 286 |
+
|
| 287 |
+
for (let j = e.particles.length - 1; j >= 0; j--) {
|
| 288 |
+
const p = e.particles[j];
|
| 289 |
+
p.x += p.speedX;
|
| 290 |
+
p.y += p.speedY;
|
| 291 |
+
|
| 292 |
+
p.element.style.left = `${p.x}px`;
|
| 293 |
+
p.element.style.top = `${p.y}px`;
|
| 294 |
+
p.element.style.opacity = e.life / 100;
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
if (e.life <= 0) {
|
| 298 |
+
e.element.remove();
|
| 299 |
+
explosions.splice(i, 1);
|
| 300 |
+
}
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
+
requestAnimationFrame(animate);
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
animate();
|
| 307 |
+
</script>
|
| 308 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=KuRRe8/mouseanimation-deepsite" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 309 |
+
</html>
|
prompts.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
制作一个页面,有鼠标拖尾彗星的效果,按键盘上任何按键,该按键的字符(仅映射常见字符)会从底部向上抛出,然后以抛物线坠落,字符要多姿多彩的,大小合适,暂时不添加音效。鼠标除了拖尾效果以外,左键右键分别有不同的爆炸烟花效果
|