Spaces:
Running
Running
Add 2 files
Browse files- README.md +7 -5
- index.html +518 -19
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: trippy-deepsite
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: red
|
| 5 |
+
colorTo: pink
|
| 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,518 @@
|
|
| 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>Psychedelic Vortex Generator</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/p5.js"></script>
|
| 9 |
+
<style>
|
| 10 |
+
body {
|
| 11 |
+
margin: 0;
|
| 12 |
+
padding: 0;
|
| 13 |
+
overflow: hidden;
|
| 14 |
+
background: #000;
|
| 15 |
+
touch-action: none;
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
#controls {
|
| 19 |
+
position: absolute;
|
| 20 |
+
bottom: 20px;
|
| 21 |
+
left: 20px;
|
| 22 |
+
z-index: 100;
|
| 23 |
+
background: rgba(0,0,0,0.5);
|
| 24 |
+
padding: 10px;
|
| 25 |
+
border-radius: 8px;
|
| 26 |
+
color: white;
|
| 27 |
+
font-family: monospace;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
.control-item {
|
| 31 |
+
margin: 8px 0;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
.hidden {
|
| 35 |
+
display: none;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
#toggleControls {
|
| 39 |
+
position: absolute;
|
| 40 |
+
bottom: 20px;
|
| 41 |
+
right: 20px;
|
| 42 |
+
z-index: 100;
|
| 43 |
+
background: rgba(0,0,0,0.5);
|
| 44 |
+
color: white;
|
| 45 |
+
border: none;
|
| 46 |
+
padding: 8px 12px;
|
| 47 |
+
border-radius: 8px;
|
| 48 |
+
cursor: pointer;
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
#audioToggle {
|
| 52 |
+
position: absolute;
|
| 53 |
+
top: 20px;
|
| 54 |
+
right: 20px;
|
| 55 |
+
z-index: 100;
|
| 56 |
+
background: rgba(0,0,0,0.5);
|
| 57 |
+
color: white;
|
| 58 |
+
border: none;
|
| 59 |
+
padding: 8px 12px;
|
| 60 |
+
border-radius: 8px;
|
| 61 |
+
cursor: pointer;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
#title {
|
| 65 |
+
position: absolute;
|
| 66 |
+
top: 20px;
|
| 67 |
+
left: 20px;
|
| 68 |
+
z-index: 100;
|
| 69 |
+
color: white;
|
| 70 |
+
font-family: monospace;
|
| 71 |
+
font-size: 24px;
|
| 72 |
+
text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #e60073, 0 0 40px #e60073;
|
| 73 |
+
opacity: 0.8;
|
| 74 |
+
}
|
| 75 |
+
</style>
|
| 76 |
+
</head>
|
| 77 |
+
<body>
|
| 78 |
+
<div id="title">PSYCHEDELIC VORTEX GENERATOR</div>
|
| 79 |
+
<button id="audioToggle">ENABLE AUDIO</button>
|
| 80 |
+
<div id="controls" class="hidden">
|
| 81 |
+
<div class="control-item">
|
| 82 |
+
<label for="particleCount">Particle Count: </label>
|
| 83 |
+
<input type="range" id="particleCount" min="100" max="5000" value="2000" step="100">
|
| 84 |
+
<span id="particleCountValue">2000</span>
|
| 85 |
+
</div>
|
| 86 |
+
<div class="control-item">
|
| 87 |
+
<label for="vortexStrength">Vortex Strength: </label>
|
| 88 |
+
<input type="range" id="vortexStrength" min="0" max="2" value="0.5" step="0.01">
|
| 89 |
+
<span id="vortexStrengthValue">0.5</span>
|
| 90 |
+
</div>
|
| 91 |
+
<div class="control-item">
|
| 92 |
+
<label for="noiseScale">Noise Scale: </label>
|
| 93 |
+
<input type="range" id="noiseScale" min="0.001" max="0.05" value="0.01" step="0.001">
|
| 94 |
+
<span id="noiseScaleValue">0.01</span>
|
| 95 |
+
</div>
|
| 96 |
+
<div class="control-item">
|
| 97 |
+
<label for="colorSpeed">Color Speed: </label>
|
| 98 |
+
<input type="range" id="colorSpeed" min="0" max="0.1" value="0.02" step="0.001">
|
| 99 |
+
<span id="colorSpeedValue">0.02</span>
|
| 100 |
+
</div>
|
| 101 |
+
<div class="control-item">
|
| 102 |
+
<label for="trailOpacity">Trail Opacity: </label>
|
| 103 |
+
<input type="range" id="trailOpacity" min="0" max="50" value="10" step="1">
|
| 104 |
+
<span id="trailOpacityValue">10</span>
|
| 105 |
+
</div>
|
| 106 |
+
<div class="control-item">
|
| 107 |
+
<label for="particleSize">Particle Size: </label>
|
| 108 |
+
<input type="range" id="particleSize" min="0.5" max="5" value="2" step="0.1">
|
| 109 |
+
<span id="particleSizeValue">2</span>
|
| 110 |
+
</div>
|
| 111 |
+
<div class="control-item">
|
| 112 |
+
<label for="mouseInfluence">Mouse Influence: </label>
|
| 113 |
+
<input type="range" id="mouseInfluence" min="0" max="2" value="1" step="0.1">
|
| 114 |
+
<span id="mouseInfluenceValue">1</span>
|
| 115 |
+
</div>
|
| 116 |
+
<div class="control-item">
|
| 117 |
+
<label for="audioSensitivity">Audio Sensitivity: </label>
|
| 118 |
+
<input type="range" id="audioSensitivity" min="0" max="500" value="100" step="10">
|
| 119 |
+
<span id="audioSensitivityValue">100</span>
|
| 120 |
+
</div>
|
| 121 |
+
</div>
|
| 122 |
+
<button id="toggleControls">TOGGLE CONTROLS</button>
|
| 123 |
+
|
| 124 |
+
<script>
|
| 125 |
+
// Main sketch
|
| 126 |
+
let particles = [];
|
| 127 |
+
let audioContext;
|
| 128 |
+
let analyser;
|
| 129 |
+
let microphone;
|
| 130 |
+
let audioEnabled = false;
|
| 131 |
+
let dataArray;
|
| 132 |
+
let fft;
|
| 133 |
+
let bassLevel = 0;
|
| 134 |
+
let midLevel = 0;
|
| 135 |
+
let highLevel = 0;
|
| 136 |
+
let hue = 0;
|
| 137 |
+
|
| 138 |
+
// Parameters with default values
|
| 139 |
+
let params = {
|
| 140 |
+
particleCount: 2000,
|
| 141 |
+
vortexStrength: 0.5,
|
| 142 |
+
noiseScale: 0.01,
|
| 143 |
+
colorSpeed: 0.02,
|
| 144 |
+
trailOpacity: 10,
|
| 145 |
+
particleSize: 2,
|
| 146 |
+
mouseInfluence: 1,
|
| 147 |
+
audioSensitivity: 100
|
| 148 |
+
};
|
| 149 |
+
|
| 150 |
+
function setup() {
|
| 151 |
+
createCanvas(windowWidth, windowHeight);
|
| 152 |
+
colorMode(HSB, 360, 100, 100, 100);
|
| 153 |
+
|
| 154 |
+
// Initialize particles
|
| 155 |
+
initParticles();
|
| 156 |
+
|
| 157 |
+
// Setup UI event listeners
|
| 158 |
+
setupUI();
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
function initParticles() {
|
| 162 |
+
particles = [];
|
| 163 |
+
for (let i = 0; i < params.particleCount; i++) {
|
| 164 |
+
particles.push(new Particle());
|
| 165 |
+
}
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
function setupUI() {
|
| 169 |
+
// Slider controls
|
| 170 |
+
document.getElementById('particleCount').addEventListener('input', function() {
|
| 171 |
+
params.particleCount = parseInt(this.value);
|
| 172 |
+
document.getElementById('particleCountValue').textContent = params.particleCount;
|
| 173 |
+
initParticles();
|
| 174 |
+
});
|
| 175 |
+
|
| 176 |
+
document.getElementById('vortexStrength').addEventListener('input', function() {
|
| 177 |
+
params.vortexStrength = parseFloat(this.value);
|
| 178 |
+
document.getElementById('vortexStrengthValue').textContent = params.vortexStrength;
|
| 179 |
+
});
|
| 180 |
+
|
| 181 |
+
document.getElementById('noiseScale').addEventListener('input', function() {
|
| 182 |
+
params.noiseScale = parseFloat(this.value);
|
| 183 |
+
document.getElementById('noiseScaleValue').textContent = params.noiseScale;
|
| 184 |
+
});
|
| 185 |
+
|
| 186 |
+
document.getElementById('colorSpeed').addEventListener('input', function() {
|
| 187 |
+
params.colorSpeed = parseFloat(this.value);
|
| 188 |
+
document.getElementById('colorSpeedValue').textContent = params.colorSpeed;
|
| 189 |
+
});
|
| 190 |
+
|
| 191 |
+
document.getElementById('trailOpacity').addEventListener('input', function() {
|
| 192 |
+
params.trailOpacity = parseInt(this.value);
|
| 193 |
+
document.getElementById('trailOpacityValue').textContent = params.trailOpacity;
|
| 194 |
+
});
|
| 195 |
+
|
| 196 |
+
document.getElementById('particleSize').addEventListener('input', function() {
|
| 197 |
+
params.particleSize = parseFloat(this.value);
|
| 198 |
+
document.getElementById('particleSizeValue').textContent = params.particleSize;
|
| 199 |
+
});
|
| 200 |
+
|
| 201 |
+
document.getElementById('mouseInfluence').addEventListener('input', function() {
|
| 202 |
+
params.mouseInfluence = parseFloat(this.value);
|
| 203 |
+
document.getElementById('mouseInfluenceValue').textContent = params.mouseInfluence;
|
| 204 |
+
});
|
| 205 |
+
|
| 206 |
+
document.getElementById('audioSensitivity').addEventListener('input', function() {
|
| 207 |
+
params.audioSensitivity = parseInt(this.value);
|
| 208 |
+
document.getElementById('audioSensitivityValue').textContent = params.audioSensitivity;
|
| 209 |
+
});
|
| 210 |
+
|
| 211 |
+
// Toggle controls button
|
| 212 |
+
document.getElementById('toggleControls').addEventListener('click', function() {
|
| 213 |
+
const controls = document.getElementById('controls');
|
| 214 |
+
controls.classList.toggle('hidden');
|
| 215 |
+
});
|
| 216 |
+
|
| 217 |
+
// Audio toggle button
|
| 218 |
+
document.getElementById('audioToggle').addEventListener('click', toggleAudio);
|
| 219 |
+
}
|
| 220 |
+
|
| 221 |
+
function toggleAudio() {
|
| 222 |
+
if (!audioEnabled) {
|
| 223 |
+
// Initialize audio context
|
| 224 |
+
audioContext = new (window.AudioContext || window.webkitAudioContext)();
|
| 225 |
+
analyser = audioContext.createAnalyser();
|
| 226 |
+
analyser.fftSize = 256;
|
| 227 |
+
|
| 228 |
+
// Get microphone input
|
| 229 |
+
navigator.mediaDevices.getUserMedia({ audio: true, video: false })
|
| 230 |
+
.then(function(stream) {
|
| 231 |
+
microphone = audioContext.createMediaStreamSource(stream);
|
| 232 |
+
microphone.connect(analyser);
|
| 233 |
+
|
| 234 |
+
dataArray = new Uint8Array(analyser.frequencyBinCount);
|
| 235 |
+
fft = new p5.FFT();
|
| 236 |
+
fft.setInput(microphone);
|
| 237 |
+
|
| 238 |
+
audioEnabled = true;
|
| 239 |
+
document.getElementById('audioToggle').textContent = 'DISABLE AUDIO';
|
| 240 |
+
})
|
| 241 |
+
.catch(function(err) {
|
| 242 |
+
console.error('Error accessing microphone:', err);
|
| 243 |
+
alert('Could not access microphone. Please check permissions.');
|
| 244 |
+
});
|
| 245 |
+
} else {
|
| 246 |
+
// Disable audio
|
| 247 |
+
if (microphone) {
|
| 248 |
+
microphone.disconnect();
|
| 249 |
+
}
|
| 250 |
+
audioEnabled = false;
|
| 251 |
+
document.getElementById('audioToggle').textContent = 'ENABLE AUDIO';
|
| 252 |
+
}
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
function draw() {
|
| 256 |
+
// Update color cycle
|
| 257 |
+
hue = (hue + params.colorSpeed) % 360;
|
| 258 |
+
|
| 259 |
+
// Background with trail effect
|
| 260 |
+
background(0, 0, 0, params.trailOpacity);
|
| 261 |
+
|
| 262 |
+
// Update audio analysis if enabled
|
| 263 |
+
if (audioEnabled) {
|
| 264 |
+
updateAudioAnalysis();
|
| 265 |
+
}
|
| 266 |
+
|
| 267 |
+
// Draw center vortex
|
| 268 |
+
drawVortex();
|
| 269 |
+
|
| 270 |
+
// Update and draw particles
|
| 271 |
+
for (let particle of particles) {
|
| 272 |
+
particle.update();
|
| 273 |
+
particle.display();
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
// Draw interactive elements
|
| 277 |
+
drawInteractiveElements();
|
| 278 |
+
}
|
| 279 |
+
|
| 280 |
+
function updateAudioAnalysis() {
|
| 281 |
+
// Get frequency data
|
| 282 |
+
analyser.getByteFrequencyData(dataArray);
|
| 283 |
+
|
| 284 |
+
// Calculate frequency ranges
|
| 285 |
+
let bassSum = 0;
|
| 286 |
+
let midSum = 0;
|
| 287 |
+
let highSum = 0;
|
| 288 |
+
|
| 289 |
+
for (let i = 0; i < dataArray.length; i++) {
|
| 290 |
+
if (i < 5) {
|
| 291 |
+
bassSum += dataArray[i];
|
| 292 |
+
} else if (i < 15) {
|
| 293 |
+
midSum += dataArray[i];
|
| 294 |
+
} else {
|
| 295 |
+
highSum += dataArray[i];
|
| 296 |
+
}
|
| 297 |
+
}
|
| 298 |
+
|
| 299 |
+
bassLevel = bassSum / 5 / 255;
|
| 300 |
+
midLevel = midSum / 10 / 255;
|
| 301 |
+
highLevel = highSum / (dataArray.length - 15) / 255;
|
| 302 |
+
}
|
| 303 |
+
|
| 304 |
+
function drawVortex() {
|
| 305 |
+
push();
|
| 306 |
+
translate(width/2, height/2);
|
| 307 |
+
|
| 308 |
+
// Base vortex effect
|
| 309 |
+
let vortexSize = width * 0.4;
|
| 310 |
+
let audioBoost = audioEnabled ? (1 + bassLevel * 0.5) : 1;
|
| 311 |
+
|
| 312 |
+
for (let i = 0; i < 360; i += 5) {
|
| 313 |
+
let angle = radians(i);
|
| 314 |
+
let dynamicSize = vortexSize * (1 + 0.2 * sin(millis() * 0.001 + i * 0.1)) * audioBoost;
|
| 315 |
+
|
| 316 |
+
let x1 = cos(angle) * dynamicSize * 0.5;
|
| 317 |
+
let y1 = sin(angle) * dynamicSize * 0.5;
|
| 318 |
+
let x2 = cos(angle) * dynamicSize;
|
| 319 |
+
let y2 = sin(angle) * dynamicSize;
|
| 320 |
+
|
| 321 |
+
let col = color((hue + i) % 360, 80, 90, 30);
|
| 322 |
+
stroke(col);
|
| 323 |
+
strokeWeight(2);
|
| 324 |
+
line(x1, y1, x2, y2);
|
| 325 |
+
|
| 326 |
+
// Add some sparkles
|
| 327 |
+
if (i % 30 === 0) {
|
| 328 |
+
let sparkleSize = 3 + 5 * (0.5 + 0.5 * sin(millis() * 0.005 + i));
|
| 329 |
+
fill(col);
|
| 330 |
+
noStroke();
|
| 331 |
+
ellipse(x2, y2, sparkleSize, sparkleSize);
|
| 332 |
+
}
|
| 333 |
+
}
|
| 334 |
+
|
| 335 |
+
pop();
|
| 336 |
+
}
|
| 337 |
+
|
| 338 |
+
function drawInteractiveElements() {
|
| 339 |
+
// Draw mouse influence area
|
| 340 |
+
if (mouseIsPressed) {
|
| 341 |
+
let pulseSize = 50 + 20 * sin(millis() * 0.01);
|
| 342 |
+
let col = color((hue + 180) % 360, 90, 100, 20);
|
| 343 |
+
fill(col);
|
| 344 |
+
noStroke();
|
| 345 |
+
ellipse(mouseX, mouseY, pulseSize, pulseSize);
|
| 346 |
+
}
|
| 347 |
+
|
| 348 |
+
// Draw audio visualization if enabled
|
| 349 |
+
if (audioEnabled) {
|
| 350 |
+
drawAudioVisualization();
|
| 351 |
+
}
|
| 352 |
+
}
|
| 353 |
+
|
| 354 |
+
function drawAudioVisualization() {
|
| 355 |
+
push();
|
| 356 |
+
translate(width/2, height/2);
|
| 357 |
+
|
| 358 |
+
// Draw frequency bars
|
| 359 |
+
let barWidth = width / (dataArray.length / 2);
|
| 360 |
+
for (let i = 0; i < dataArray.length / 2; i++) {
|
| 361 |
+
let barHeight = dataArray[i] * params.audioSensitivity / 255;
|
| 362 |
+
let col = color((hue + i * 5) % 360, 80, 90, 50);
|
| 363 |
+
|
| 364 |
+
fill(col);
|
| 365 |
+
noStroke();
|
| 366 |
+
rectMode(CENTER);
|
| 367 |
+
rect(
|
| 368 |
+
(i - dataArray.length / 4) * barWidth,
|
| 369 |
+
height * 0.4,
|
| 370 |
+
barWidth * 0.8,
|
| 371 |
+
-barHeight
|
| 372 |
+
);
|
| 373 |
+
}
|
| 374 |
+
|
| 375 |
+
pop();
|
| 376 |
+
}
|
| 377 |
+
|
| 378 |
+
function windowResized() {
|
| 379 |
+
resizeCanvas(windowWidth, windowHeight);
|
| 380 |
+
}
|
| 381 |
+
|
| 382 |
+
// Particle class
|
| 383 |
+
class Particle {
|
| 384 |
+
constructor() {
|
| 385 |
+
this.reset();
|
| 386 |
+
this.velocity = p5.Vector.random2D().mult(random(0.5, 2));
|
| 387 |
+
this.size = random(params.particleSize * 0.5, params.particleSize * 1.5);
|
| 388 |
+
this.hueOffset = random(360);
|
| 389 |
+
this.life = random(100, 200);
|
| 390 |
+
this.age = 0;
|
| 391 |
+
this.z = random(-100, 100);
|
| 392 |
+
}
|
| 393 |
+
|
| 394 |
+
reset() {
|
| 395 |
+
this.position = createVector(random(width), random(height));
|
| 396 |
+
this.velocity = p5.Vector.random2D().mult(random(0.5, 2));
|
| 397 |
+
this.acceleration = createVector(0, 0);
|
| 398 |
+
this.size = random(params.particleSize * 0.5, params.particleSize * 1.5);
|
| 399 |
+
this.hueOffset = random(360);
|
| 400 |
+
this.life = random(100, 200);
|
| 401 |
+
this.age = 0;
|
| 402 |
+
this.z = random(-100, 100);
|
| 403 |
+
}
|
| 404 |
+
|
| 405 |
+
update() {
|
| 406 |
+
this.age++;
|
| 407 |
+
if (this.age > this.life) {
|
| 408 |
+
this.reset();
|
| 409 |
+
this.age = 0;
|
| 410 |
+
}
|
| 411 |
+
|
| 412 |
+
// Apply vortex force
|
| 413 |
+
let center = createVector(width/2, height/2);
|
| 414 |
+
let toCenter = p5.Vector.sub(center, this.position);
|
| 415 |
+
let distance = toCenter.mag();
|
| 416 |
+
toCenter.normalize();
|
| 417 |
+
|
| 418 |
+
// Vortex effect with audio modulation
|
| 419 |
+
let audioMod = audioEnabled ? (1 + bassLevel * 0.5) : 1;
|
| 420 |
+
let vortexForce = toCenter.copy();
|
| 421 |
+
vortexForce.rotate(HALF_PI);
|
| 422 |
+
vortexForce.mult(params.vortexStrength * audioMod * (1 + 0.2 * sin(distance * 0.01 - millis() * 0.001)));
|
| 423 |
+
vortexForce.mult(map(distance, 0, width/2, 2, 0.1));
|
| 424 |
+
|
| 425 |
+
// Apply noise force
|
| 426 |
+
let noiseForce = createVector(
|
| 427 |
+
noise(this.position.x * params.noiseScale, this.position.y * params.noiseScale, millis() * 0.0001) - 0.5,
|
| 428 |
+
noise(this.position.y * params.noiseScale, millis() * 0.0001, this.position.x * params.noiseScale) - 0.5
|
| 429 |
+
);
|
| 430 |
+
noiseForce.mult(0.5);
|
| 431 |
+
|
| 432 |
+
// Apply mouse influence if mouse is pressed
|
| 433 |
+
let mouseForce = createVector(0, 0);
|
| 434 |
+
if (mouseIsPressed) {
|
| 435 |
+
let toMouse = p5.Vector.sub(createVector(mouseX, mouseY), this.position);
|
| 436 |
+
let mouseDist = toMouse.mag();
|
| 437 |
+
if (mouseDist < 200) {
|
| 438 |
+
toMouse.normalize();
|
| 439 |
+
mouseForce = toMouse.mult(params.mouseInfluence * map(mouseDist, 0, 200, 1, 0));
|
| 440 |
+
}
|
| 441 |
+
}
|
| 442 |
+
|
| 443 |
+
// Combine all forces
|
| 444 |
+
this.acceleration.add(vortexForce);
|
| 445 |
+
this.acceleration.add(noiseForce);
|
| 446 |
+
this.acceleration.add(mouseForce);
|
| 447 |
+
|
| 448 |
+
// Apply audio forces if enabled
|
| 449 |
+
if (audioEnabled) {
|
| 450 |
+
// Bass pushes particles outward
|
| 451 |
+
let audioOutwardForce = toCenter.copy();
|
| 452 |
+
audioOutwardForce.mult(-bassLevel * 0.5);
|
| 453 |
+
|
| 454 |
+
// High frequencies add randomness
|
| 455 |
+
let audioRandomForce = p5.Vector.random2D().mult(highLevel * 0.3);
|
| 456 |
+
|
| 457 |
+
this.acceleration.add(audioOutwardForce);
|
| 458 |
+
this.acceleration.add(audioRandomForce);
|
| 459 |
+
}
|
| 460 |
+
|
| 461 |
+
// Update physics
|
| 462 |
+
this.velocity.add(this.acceleration);
|
| 463 |
+
this.velocity.limit(3);
|
| 464 |
+
this.position.add(this.velocity);
|
| 465 |
+
this.acceleration.mult(0);
|
| 466 |
+
|
| 467 |
+
// Wrap around edges
|
| 468 |
+
if (this.position.x < 0) this.position.x = width;
|
| 469 |
+
if (this.position.x > width) this.position.x = 0;
|
| 470 |
+
if (this.position.y < 0) this.position.y = height;
|
| 471 |
+
if (this.position.y > height) this.position.y = 0;
|
| 472 |
+
|
| 473 |
+
// Z-depth movement
|
| 474 |
+
this.z += random(-0.5, 0.5);
|
| 475 |
+
this.z = constrain(this.z, -100, 100);
|
| 476 |
+
}
|
| 477 |
+
|
| 478 |
+
display() {
|
| 479 |
+
let distanceToCenter = dist(this.position.x, this.position.y, width/2, height/2);
|
| 480 |
+
let distanceFactor = map(distanceToCenter, 0, width/2, 0.3, 1);
|
| 481 |
+
|
| 482 |
+
// Calculate color with audio modulation
|
| 483 |
+
let particleHue = (hue + this.hueOffset + (audioEnabled ? midLevel * 50 : 0)) % 360;
|
| 484 |
+
let saturation = map(distanceToCenter, 0, width/2, 30, 90);
|
| 485 |
+
let brightness = 70 + (audioEnabled ? highLevel * 30 : 0);
|
| 486 |
+
let alpha = map(this.age, 0, this.life, 30, 80) * distanceFactor;
|
| 487 |
+
|
| 488 |
+
// Size with audio modulation
|
| 489 |
+
let displaySize = this.size * (1 + (audioEnabled ? bassLevel * 0.5 : 0));
|
| 490 |
+
|
| 491 |
+
// Draw particle
|
| 492 |
+
noStroke();
|
| 493 |
+
fill(particleHue, saturation, brightness, alpha);
|
| 494 |
+
|
| 495 |
+
// Add some depth with z position
|
| 496 |
+
let zFactor = map(this.z, -100, 100, 0.7, 1.3);
|
| 497 |
+
ellipse(
|
| 498 |
+
this.position.x,
|
| 499 |
+
this.position.y,
|
| 500 |
+
displaySize * zFactor,
|
| 501 |
+
displaySize * zFactor
|
| 502 |
+
);
|
| 503 |
+
|
| 504 |
+
// Add glow effect for some particles
|
| 505 |
+
if (random() < 0.1) {
|
| 506 |
+
fill(particleHue, saturation, brightness, alpha * 0.3);
|
| 507 |
+
ellipse(
|
| 508 |
+
this.position.x,
|
| 509 |
+
this.position.y,
|
| 510 |
+
displaySize * zFactor * 3,
|
| 511 |
+
displaySize * zFactor * 3
|
| 512 |
+
);
|
| 513 |
+
}
|
| 514 |
+
}
|
| 515 |
+
}
|
| 516 |
+
</script>
|
| 517 |
+
<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=maydayjeffk/trippy-deepsite" style="color: #fff;text-decoration: underline;" target="_blank" >🧬 Remix</a></p></body>
|
| 518 |
+
</html>
|