Spaces:
Running
Running
Upload folder using huggingface_hub
Browse files- index.html +308 -228
index.html
CHANGED
|
@@ -1,248 +1,328 @@
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html lang="en">
|
|
|
|
| 3 |
<head>
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
|
|
|
| 56 |
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
</head>
|
|
|
|
| 90 |
<body>
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
|
|
|
|
|
|
| 145 |
}
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
| 163 |
-
const p = 2 * l - q;
|
| 164 |
-
r = hue2rgb(p, q, h + 1/3);
|
| 165 |
-
g = hue2rgb(p, q, h);
|
| 166 |
-
b = hue2rgb(p, q, h - 1/3);
|
| 167 |
-
}
|
| 168 |
-
|
| 169 |
-
return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];
|
| 170 |
}
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
}
|
| 223 |
}
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 232 |
}
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
</body>
|
|
|
|
| 248 |
</html>
|
|
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html lang="en">
|
| 3 |
+
|
| 4 |
<head>
|
| 5 |
+
<meta charset="UTF-8">
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
+
<title>ASCII Wave Animation</title>
|
| 8 |
+
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&display=swap" rel="stylesheet">
|
| 9 |
+
<style>
|
| 10 |
+
* {
|
| 11 |
+
margin: 0;
|
| 12 |
+
padding: 0;
|
| 13 |
+
box-sizing: border-box;
|
| 14 |
+
}
|
| 15 |
|
| 16 |
+
body {
|
| 17 |
+
background-color: #000;
|
| 18 |
+
min-height: 100vh;
|
| 19 |
+
display: flex;
|
| 20 |
+
flex-direction: column;
|
| 21 |
+
align-items: center;
|
| 22 |
+
justify-content: center;
|
| 23 |
+
font-family: 'JetBrains Mono', monospace;
|
| 24 |
+
overflow: hidden;
|
| 25 |
+
}
|
| 26 |
|
| 27 |
+
header {
|
| 28 |
+
position: fixed;
|
| 29 |
+
top: 0;
|
| 30 |
+
left: 0;
|
| 31 |
+
width: 100%;
|
| 32 |
+
padding: 1rem;
|
| 33 |
+
text-align: center;
|
| 34 |
+
z-index: 100;
|
| 35 |
+
}
|
| 36 |
|
| 37 |
+
header a {
|
| 38 |
+
color: #444;
|
| 39 |
+
text-decoration: none;
|
| 40 |
+
font-size: 0.8rem;
|
| 41 |
+
letter-spacing: 2px;
|
| 42 |
+
transition: color 0.3s ease;
|
| 43 |
+
}
|
| 44 |
|
| 45 |
+
header a:hover {
|
| 46 |
+
color: #888;
|
| 47 |
+
}
|
| 48 |
|
| 49 |
+
#ascii-container {
|
| 50 |
+
display: flex;
|
| 51 |
+
flex-direction: column;
|
| 52 |
+
align-items: center;
|
| 53 |
+
justify-content: center;
|
| 54 |
+
gap: 0;
|
| 55 |
+
line-height: 1.2;
|
| 56 |
+
cursor: none;
|
| 57 |
+
}
|
| 58 |
|
| 59 |
+
.ascii-row {
|
| 60 |
+
display: flex;
|
| 61 |
+
gap: 0;
|
| 62 |
+
}
|
| 63 |
|
| 64 |
+
.ascii-char {
|
| 65 |
+
width: clamp(8px, 2vw, 16px);
|
| 66 |
+
height: clamp(12px, 2.5vw, 20px);
|
| 67 |
+
display: flex;
|
| 68 |
+
align-items: center;
|
| 69 |
+
justify-content: center;
|
| 70 |
+
font-size: clamp(8px, 2vw, 16px);
|
| 71 |
+
color: #fff;
|
| 72 |
+
transition: transform 0.15s ease-out, text-shadow 0.15s ease-out;
|
| 73 |
+
}
|
| 74 |
|
| 75 |
+
@media (max-width: 768px) {
|
| 76 |
+
.ascii-char {
|
| 77 |
+
width: 6px;
|
| 78 |
+
height: 10px;
|
| 79 |
+
font-size: 6px;
|
| 80 |
+
}
|
| 81 |
+
}
|
| 82 |
|
| 83 |
+
@media (max-width: 480px) {
|
| 84 |
+
.ascii-char {
|
| 85 |
+
width: 5px;
|
| 86 |
+
height: 8px;
|
| 87 |
+
font-size: 5px;
|
| 88 |
+
}
|
| 89 |
+
}
|
| 90 |
+
</style>
|
| 91 |
</head>
|
| 92 |
+
|
| 93 |
<body>
|
| 94 |
+
<header>
|
| 95 |
+
<a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank">Built with anycoder</a>
|
| 96 |
+
</header>
|
| 97 |
+
|
| 98 |
+
<div id="ascii-container"></div>
|
| 99 |
+
|
| 100 |
+
<script>
|
| 101 |
+
const container = document.getElementById('ascii-container');
|
| 102 |
+
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@#$%&*!?<>[]{}|/\\~^';
|
| 103 |
+
|
| 104 |
+
let cols, rows;
|
| 105 |
+
let grid = [];
|
| 106 |
+
let time = 0;
|
| 107 |
+
let mouseX = -1000;
|
| 108 |
+
let mouseY = -1000;
|
| 109 |
+
let targetMouseX = -1000;
|
| 110 |
+
let targetMouseY = -1000;
|
| 111 |
+
let isMouseInside = false;
|
| 112 |
+
|
| 113 |
+
function calculateGridSize() {
|
| 114 |
+
const charWidth = Math.max(8, Math.min(16, window.innerWidth * 0.02));
|
| 115 |
+
const charHeight = Math.max(12, Math.min(20, window.innerWidth * 0.025));
|
| 116 |
+
|
| 117 |
+
cols = Math.floor(window.innerWidth / charWidth);
|
| 118 |
+
rows = Math.floor(window.innerHeight / charHeight);
|
| 119 |
+
|
| 120 |
+
// Ensure minimum grid size
|
| 121 |
+
cols = Math.max(40, Math.min(cols, 120));
|
| 122 |
+
rows = Math.max(20, Math.min(rows, 60));
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
function getRandomChar() {
|
| 126 |
+
return characters[Math.floor(Math.random() * characters.length)];
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
function createGrid() {
|
| 130 |
+
container.innerHTML = '';
|
| 131 |
+
grid = [];
|
| 132 |
+
|
| 133 |
+
for (let y = 0; y < rows; y++) {
|
| 134 |
+
const row = document.createElement('div');
|
| 135 |
+
row.className = 'ascii-row';
|
| 136 |
+
const rowData = [];
|
| 137 |
+
|
| 138 |
+
for (let x = 0; x < cols; x++) {
|
| 139 |
+
const charSpan = document.createElement('span');
|
| 140 |
+
charSpan.className = 'ascii-char';
|
| 141 |
+
charSpan.textContent = getRandomChar();
|
| 142 |
+
row.appendChild(charSpan);
|
| 143 |
+
rowData.push({
|
| 144 |
+
element: charSpan,
|
| 145 |
+
baseChar: getRandomChar(),
|
| 146 |
+
changeTimer: Math.random() * 100,
|
| 147 |
+
x: 0,
|
| 148 |
+
y: 0
|
| 149 |
+
});
|
| 150 |
}
|
| 151 |
+
|
| 152 |
+
container.appendChild(row);
|
| 153 |
+
grid.push(rowData);
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
// Calculate positions after grid is created
|
| 157 |
+
updateCellPositions();
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
function updateCellPositions() {
|
| 161 |
+
for (let y = 0; y < rows; y++) {
|
| 162 |
+
for (let x = 0; x < cols; x++) {
|
| 163 |
+
const cell = grid[y][x];
|
| 164 |
+
const rect = cell.element.getBoundingClientRect();
|
| 165 |
+
cell.x = rect.left + rect.width / 2;
|
| 166 |
+
cell.y = rect.top + rect.height / 2;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
}
|
| 168 |
+
}
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
function animate() {
|
| 172 |
+
time += 0.03;
|
| 173 |
+
|
| 174 |
+
// Smooth mouse following
|
| 175 |
+
mouseX += (targetMouseX - mouseX) * 0.15;
|
| 176 |
+
mouseY += (targetMouseY - mouseY) * 0.15;
|
| 177 |
+
|
| 178 |
+
for (let y = 0; y < rows; y++) {
|
| 179 |
+
for (let x = 0; x < cols; x++) {
|
| 180 |
+
const cell = grid[y][x];
|
| 181 |
+
|
| 182 |
+
// Multiple wave patterns combined
|
| 183 |
+
const wave1 = Math.sin(x * 0.1 + time) * 0.5;
|
| 184 |
+
const wave2 = Math.sin(y * 0.08 + time * 1.3) * 0.3;
|
| 185 |
+
const wave3 = Math.sin((x + y) * 0.05 + time * 0.7) * 0.4;
|
| 186 |
+
const wave4 = Math.cos(x * 0.15 - time * 0.5) * Math.sin(y * 0.12 + time * 0.8) * 0.3;
|
| 187 |
+
|
| 188 |
+
// Radial wave from center
|
| 189 |
+
const centerX = cols / 2;
|
| 190 |
+
const centerY = rows / 2;
|
| 191 |
+
const distFromCenter = Math.sqrt((x - centerX) ** 2 + (y - centerY) ** 2);
|
| 192 |
+
const radialWave = Math.sin(distFromCenter * 0.15 - time * 2) * 0.4;
|
| 193 |
+
|
| 194 |
+
let combinedWave = wave1 + wave2 + wave3 + wave4 + radialWave;
|
| 195 |
+
|
| 196 |
+
// Mouse interaction
|
| 197 |
+
let mouseInfluence = 0;
|
| 198 |
+
let pushX = 0;
|
| 199 |
+
let pushY = 0;
|
| 200 |
+
|
| 201 |
+
if (isMouseInside) {
|
| 202 |
+
const dx = cell.x - mouseX;
|
| 203 |
+
const dy = cell.y - mouseY;
|
| 204 |
+
const distance = Math.sqrt(dx * dx + dy * dy);
|
| 205 |
+
const maxDistance = 150;
|
| 206 |
+
|
| 207 |
+
if (distance < maxDistance) {
|
| 208 |
+
const strength = 1 - (distance / maxDistance);
|
| 209 |
+
mouseInfluence = strength * strength;
|
| 210 |
+
|
| 211 |
+
// Push characters away from mouse
|
| 212 |
+
const angle = Math.atan2(dy, dx);
|
| 213 |
+
const pushStrength = mouseInfluence * 20;
|
| 214 |
+
pushX = Math.cos(angle) * pushStrength;
|
| 215 |
+
pushY = Math.sin(angle) * pushStrength;
|
| 216 |
+
|
| 217 |
+
// Add ripple effect around mouse
|
| 218 |
+
combinedWave += Math.sin(distance * 0.1 - time * 4) * mouseInfluence * 0.8;
|
|
|
|
| 219 |
}
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
// Calculate brightness based on wave and mouse
|
| 223 |
+
const baseBrightness = 0.2 + (combinedWave + 1) * 0.3;
|
| 224 |
+
const brightness = Math.min(1, baseBrightness + mouseInfluence * 0.8);
|
| 225 |
+
|
| 226 |
+
// Apply transformations
|
| 227 |
+
const baseScale = 0.7 + (combinedWave + 1) * 0.25;
|
| 228 |
+
const scale = baseScale + mouseInfluence * 0.5;
|
| 229 |
+
const translateY = combinedWave * 5 + pushY;
|
| 230 |
+
const translateX = pushX;
|
| 231 |
+
|
| 232 |
+
// White color with varying opacity
|
| 233 |
+
const alpha = Math.max(0.15, Math.min(1, brightness));
|
| 234 |
+
cell.element.style.color = `rgba(255, 255, 255, ${alpha})`;
|
| 235 |
+
cell.element.style.transform = `translate(${translateX}px, ${translateY}px) scale(${scale})`;
|
| 236 |
+
|
| 237 |
+
// Add glow effect near mouse
|
| 238 |
+
if (mouseInfluence > 0.3) {
|
| 239 |
+
const glowIntensity = mouseInfluence * 15;
|
| 240 |
+
cell.element.style.textShadow = `0 0 ${glowIntensity}px rgba(255, 255, 255, ${mouseInfluence})`;
|
| 241 |
+
} else {
|
| 242 |
+
cell.element.style.textShadow = 'none';
|
| 243 |
+
}
|
| 244 |
+
|
| 245 |
+
// Randomly change characters
|
| 246 |
+
cell.changeTimer += 0.1 + mouseInfluence * 0.5;
|
| 247 |
+
if (cell.changeTimer > 50 + Math.random() * 100) {
|
| 248 |
+
cell.element.textContent = getRandomChar();
|
| 249 |
+
cell.changeTimer = 0;
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
// More frequent changes at wave peaks and near mouse
|
| 253 |
+
if ((combinedWave > 0.8 || mouseInfluence > 0.5) && Math.random() < 0.15) {
|
| 254 |
+
cell.element.textContent = getRandomChar();
|
| 255 |
+
}
|
| 256 |
}
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
requestAnimationFrame(animate);
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
function init() {
|
| 263 |
+
calculateGridSize();
|
| 264 |
+
createGrid();
|
| 265 |
+
animate();
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
// Mouse event handlers
|
| 269 |
+
document.addEventListener('mousemove', (e) => {
|
| 270 |
+
targetMouseX = e.clientX;
|
| 271 |
+
targetMouseY = e.clientY;
|
| 272 |
+
isMouseInside = true;
|
| 273 |
+
});
|
| 274 |
+
|
| 275 |
+
document.addEventListener('mouseleave', () => {
|
| 276 |
+
isMouseInside = false;
|
| 277 |
+
targetMouseX = -1000;
|
| 278 |
+
targetMouseY = -1000;
|
| 279 |
+
});
|
| 280 |
+
|
| 281 |
+
document.addEventListener('mouseenter', () => {
|
| 282 |
+
isMouseInside = true;
|
| 283 |
+
});
|
| 284 |
+
|
| 285 |
+
// Touch support for mobile
|
| 286 |
+
document.addEventListener('touchmove', (e) => {
|
| 287 |
+
if (e.touches.length > 0) {
|
| 288 |
+
targetMouseX = e.touches[0].clientX;
|
| 289 |
+
targetMouseY = e.touches[0].clientY;
|
| 290 |
+
isMouseInside = true;
|
| 291 |
+
}
|
| 292 |
+
});
|
| 293 |
+
|
| 294 |
+
document.addEventListener('touchstart', (e) => {
|
| 295 |
+
if (e.touches.length > 0) {
|
| 296 |
+
targetMouseX = e.touches[0].clientX;
|
| 297 |
+
targetMouseY = e.touches[0].clientY;
|
| 298 |
+
mouseX = targetMouseX;
|
| 299 |
+
mouseY = targetMouseY;
|
| 300 |
+
isMouseInside = true;
|
| 301 |
+
}
|
| 302 |
+
});
|
| 303 |
+
|
| 304 |
+
document.addEventListener('touchend', () => {
|
| 305 |
+
isMouseInside = false;
|
| 306 |
+
targetMouseX = -1000;
|
| 307 |
+
targetMouseY = -1000;
|
| 308 |
+
});
|
| 309 |
+
|
| 310 |
+
// Handle window resize
|
| 311 |
+
let resizeTimeout;
|
| 312 |
+
window.addEventListener('resize', () => {
|
| 313 |
+
clearTimeout(resizeTimeout);
|
| 314 |
+
resizeTimeout = setTimeout(() => {
|
| 315 |
+
calculateGridSize();
|
| 316 |
+
createGrid();
|
| 317 |
+
}, 250);
|
| 318 |
+
});
|
| 319 |
+
|
| 320 |
+
// Update cell positions on scroll (if any)
|
| 321 |
+
window.addEventListener('scroll', updateCellPositions);
|
| 322 |
+
|
| 323 |
+
// Initialize
|
| 324 |
+
init();
|
| 325 |
+
</script>
|
| 326 |
</body>
|
| 327 |
+
|
| 328 |
</html>
|