Spaces:
Running
Running
Can you add gardient effect over the lines and increase the effects of the border? I also want to be able to add fill out the white center. - Initial Deployment
Browse files- README.md +7 -5
- index.html +563 -18
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: cat
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: red
|
| 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,564 @@
|
|
| 1 |
<!doctype html>
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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, initial-scale=1.0" />
|
| 6 |
+
<title>Wavy Portal Effect - Pulsing Lines</title>
|
| 7 |
+
<style>
|
| 8 |
+
body {
|
| 9 |
+
margin: 0;
|
| 10 |
+
overflow: hidden;
|
| 11 |
+
display: flex;
|
| 12 |
+
justify-content: center;
|
| 13 |
+
align-items: center;
|
| 14 |
+
min-height: 100vh;
|
| 15 |
+
background-color: #f0f0f0; /* Light background similar to image */
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
#myCanvas {
|
| 19 |
+
background-color: #e6e6e6; /* Slight off-white for the background */
|
| 20 |
+
display: block;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
#controls {
|
| 24 |
+
position: absolute;
|
| 25 |
+
top: 10px;
|
| 26 |
+
left: 10px;
|
| 27 |
+
background: rgba(255,255,255,0.8);
|
| 28 |
+
padding: 10px;
|
| 29 |
+
border-radius: 5px;
|
| 30 |
+
z-index: 100;
|
| 31 |
+
max-width: 300px;
|
| 32 |
+
}
|
| 33 |
+
#controls fieldset {
|
| 34 |
+
margin-bottom: 10px;
|
| 35 |
+
border: 1px solid #ccc;
|
| 36 |
+
}
|
| 37 |
+
#controls label {
|
| 38 |
+
display: block;
|
| 39 |
+
margin: 5px 0;
|
| 40 |
+
}
|
| 41 |
+
#controls input[type="range"] {
|
| 42 |
+
width: 100%;
|
| 43 |
+
}
|
| 44 |
+
#textOverlay {
|
| 45 |
+
position: absolute;
|
| 46 |
+
color: #000;
|
| 47 |
+
font-family: sans-serif;
|
| 48 |
+
font-size: 2em;
|
| 49 |
+
text-align: center;
|
| 50 |
+
user-select: none; /* Prevent text selection */
|
| 51 |
+
pointer-events: none; /* Allow mouse events to pass through to canvas */
|
| 52 |
+
}
|
| 53 |
+
</style>
|
| 54 |
+
</head>
|
| 55 |
+
<body>
|
| 56 |
+
<div id="controls">
|
| 57 |
+
<fieldset>
|
| 58 |
+
<legend>Text Settings</legend>
|
| 59 |
+
<label>Text Line 1: <input type="text" id="textLine1" value="The portal has closed,"></label>
|
| 60 |
+
<label>Text Line 2: <input type="text" id="textLine2" value="see you on the other side"></label>
|
| 61 |
+
<label>Font Family:
|
| 62 |
+
<select id="fontFamily">
|
| 63 |
+
<option value="sans-serif">Sans-serif</option>
|
| 64 |
+
<option value="serif">Serif</option>
|
| 65 |
+
<option value="monospace">Monospace</option>
|
| 66 |
+
<option value="Arial">Arial</option>
|
| 67 |
+
<option value="Courier New">Courier New</option>
|
| 68 |
+
</select>
|
| 69 |
+
</label>
|
| 70 |
+
<label>Font Size: <input type="range" id="fontSize" min="10" max="100" value="32"></label>
|
| 71 |
+
<label>Text Color: <input type="color" id="textColor" value="#000000"></label>
|
| 72 |
+
</fieldset>
|
| 73 |
+
|
| 74 |
+
<fieldset>
|
| 75 |
+
<legend>Background</legend>
|
| 76 |
+
<label>Color: <input type="color" id="bgColor" value="#f0f0f0"></label>
|
| 77 |
+
<label>Vignette Strength: <input type="range" id="vignetteStrength" min="0" max="2" step="0.1" value="0.5"></label>
|
| 78 |
+
<label>Pattern Type:
|
| 79 |
+
<select id="patternType">
|
| 80 |
+
<option value="none">None</option>
|
| 81 |
+
<option value="grid">Grid</option>
|
| 82 |
+
<option value="dots">Dots</option>
|
| 83 |
+
<option value="lines">Lines</option>
|
| 84 |
+
</select>
|
| 85 |
+
</label>
|
| 86 |
+
<label>Pattern Scale: <input type="range" id="patternScale" min="10" max="200" value="50"></label>
|
| 87 |
+
</fieldset>
|
| 88 |
+
|
| 89 |
+
<fieldset>
|
| 90 |
+
<legend>Animation/LFO</legend>
|
| 91 |
+
<label>Animate Radius: <input type="checkbox" id="animateRadius"></label>
|
| 92 |
+
<label>Radius Speed: <input type="range" id="radiusSpeed" min="0" max="0.1" step="0.001" value="0.02"></label>
|
| 93 |
+
<label>Animate Wave Amp: <input type="checkbox" id="animateWaveAmp"></label>
|
| 94 |
+
<label>Wave Amp Speed: <input type="range" id="waveAmpSpeed" min="0" max="0.1" step="0.001" value="0.03"></label>
|
| 95 |
+
</fieldset>
|
| 96 |
+
|
| 97 |
+
<fieldset>
|
| 98 |
+
<legend>Circle Settings</legend>
|
| 99 |
+
<label>Radius: <input type="range" id="circleRadius" min="100" max="800" step="10" value="450"></label>
|
| 100 |
+
<label>Border Color: <input type="color" id="borderColor" value="#b7a48"></label>
|
| 101 |
+
</fieldset>
|
| 102 |
+
|
| 103 |
+
<fieldset>
|
| 104 |
+
<legend>Line Settings</legend>
|
| 105 |
+
<label>Color: <input type="color" id="lineColor" value="#0059"></label>
|
| 106 |
+
<label>Number: <input type="range" id="numLines" min="10" max="1000" step="10" value="400"></label>
|
| 107 |
+
<label>Max Length: <input type="range" id="maxLineLength" min="100" max="1000" step="10" value="500"></label>
|
| 108 |
+
</fieldset>
|
| 109 |
+
|
| 110 |
+
<fieldset>
|
| 111 |
+
<legend>Line Width</legend>
|
| 112 |
+
<label>Base: <input type="range" id="lineWidthBase" min="0.1" max="5" step="0.1" value="2.5"></label>
|
| 113 |
+
<label>Amplitude: <input type="range" id="lineWidthAmplitude" min="0" max="3" step="0.1" value="1.5"></label>
|
| 114 |
+
<label>Frequency: <input type="range" id="lineWidthFrequency" min="0" max="0.5" step="0.01" value="0.1"></label>
|
| 115 |
+
<label>Min: <input type="range" id="lineWidthMin" min="0.1" max="2" step="0.1" value="0.5"></label>
|
| 116 |
+
</fieldset>
|
| 117 |
+
|
| 118 |
+
<fieldset>
|
| 119 |
+
<legend>Wave Settings</legend>
|
| 120 |
+
<label>Amplitude: <input type="range" id="waveAmplitude" min="0" max="50" step="1" value="15"></label>
|
| 121 |
+
<label>Frequency: <input type="range" id="waveFrequency" min="0" max="0.2" step="0.001" value="0.04"></label>
|
| 122 |
+
<label>Speed: <input type="range" id="waveSpeed" min="0" max="0.2" step="0.001" value="0.05"></label>
|
| 123 |
+
<label>Phase Spread: <input type="range" id="wavePhaseSpread" min="0" max="6.28" step="0.1" value="6.28"></label>
|
| 124 |
+
</fieldset>
|
| 125 |
+
</div>
|
| 126 |
+
|
| 127 |
+
<canvas id="myCanvas"></canvas>
|
| 128 |
+
<div id="textOverlay"></div>
|
| 129 |
+
|
| 130 |
+
<script>
|
| 131 |
+
const canvas = document.getElementById('myCanvas');
|
| 132 |
+
const ctx = canvas.getContext('2d');
|
| 133 |
+
const textOverlay = document.getElementById('textOverlay');
|
| 134 |
+
|
| 135 |
+
let mouseX = 0;
|
| 136 |
+
let mouseY = 0;
|
| 137 |
+
let animationTime = 0; // Global time for animation
|
| 138 |
+
|
| 139 |
+
// --- Configuration Object ---
|
| 140 |
+
// All adjustable parameters are now grouped here for easier access
|
| 141 |
+
const config = {
|
| 142 |
+
circleRadius: 450, // Radius of the central circle
|
| 143 |
+
text: {
|
| 144 |
+
line1: "The portal has closed,",
|
| 145 |
+
line2: "see you on the other side",
|
| 146 |
+
fontFamily: "sans-serif",
|
| 147 |
+
fontSize: 32,
|
| 148 |
+
color: "#000000"
|
| 149 |
+
},
|
| 150 |
+
background: {
|
| 151 |
+
color: "#f0f0f0",
|
| 152 |
+
vignetteStrength: 0.5,
|
| 153 |
+
patternType: "none",
|
| 154 |
+
patternScale: 50
|
| 155 |
+
},
|
| 156 |
+
animation: {
|
| 157 |
+
radius: {
|
| 158 |
+
enabled: false,
|
| 159 |
+
speed: 0.02
|
| 160 |
+
},
|
| 161 |
+
waveAmplitude: {
|
| 162 |
+
enabled: false,
|
| 163 |
+
speed: 0.03
|
| 164 |
+
}
|
| 165 |
+
},
|
| 166 |
+
lineColor: '#0059', // Dark blue
|
| 167 |
+
borderColor: '#b7a48', // Brown border
|
| 168 |
+
lineWidth: {
|
| 169 |
+
base: 2.5, // Base line width
|
| 170 |
+
amplitude: 1.5, // Max variation from base
|
| 171 |
+
frequency: 0.1, // How fast the line width pulses
|
| 172 |
+
min: 0.5, // Minimum allowed line width
|
| 173 |
+
},
|
| 174 |
+
numLines: 400, // Number of field lines
|
| 175 |
+
lineSegmentLength: 5, // Length of each small step
|
| 176 |
+
maxLineLength: 500, // Max distance lines will extend
|
| 177 |
+
|
| 178 |
+
// Wave Effect Parameters
|
| 179 |
+
waveAmplitude: 15, // Max sideways displacement of the wave
|
| 180 |
+
waveFrequency: 0.04, // How many waves per unit length (lower is more spread out)
|
| 181 |
+
waveSpeed: 0.05, // Speed at which waves travel along lines
|
| 182 |
+
wavePhaseSpread: Math.PI * 2, // How much to offset waves for adjacent lines
|
| 183 |
+
|
| 184 |
+
// Define "poles" on the circle's edge for complex field lines
|
| 185 |
+
poles: [
|
| 186 |
+
// Original poles from previous versions
|
| 187 |
+
// { angle: Math.PI * 0.1, type: 'repel', strength: 0.8 },
|
| 188 |
+
// { angle: Math.PI * 0.4, type: 'attract', strength: 0.6 },
|
| 189 |
+
// { angle: Math.PI * 0.6, type: 'repel', strength: 0.7 },
|
| 190 |
+
// { angle: Math.PI * 1.1, type: 'attract', strength: 0.5 },
|
| 191 |
+
// { angle: Math.PI * 1.6, type: 'repel', strength: 0.9 },
|
| 192 |
+
// { angle: Math.PI * 1.9, type: 'attract', strength: 0.7 },
|
| 193 |
+
//
|
| 194 |
+
// New pole configurations based on the image
|
| 195 |
+
{ angle: Math.PI * 0, type: 'repel', strength: 1.8 },
|
| 196 |
+
{ angle: Math.PI * 0.8, type: 'attract', strength: 1.6 },
|
| 197 |
+
{ angle: Math.PI * 0.6, type: 'repel', strength: 7.7 },
|
| 198 |
+
{ angle: Math.PI * 0.9, type: 'attract', strength: 0.5 },
|
| 199 |
+
{ angle: Math.PI * 1.6, type: 'repel', strength: 2.9 },
|
| 200 |
+
{ angle: Math.PI * 1.9, type: 'attract', strength: 0.7 },
|
| 201 |
+
],
|
| 202 |
+
};
|
| 203 |
+
|
| 204 |
+
// --- Canvas Sizing ---
|
| 205 |
+
function resizeCanvas() {
|
| 206 |
+
canvas.width = window.innerWidth;
|
| 207 |
+
canvas.height = window.innerHeight;
|
| 208 |
+
// Position text overlay
|
| 209 |
+
updateTextOverlay();
|
| 210 |
+
textOverlay.style.left = `${(canvas.width - textOverlay.offsetWidth) / 2}px`;
|
| 211 |
+
textOverlay.style.top = `${(canvas.height - textOverlay.offsetHeight) / 2}px`;
|
| 212 |
+
}
|
| 213 |
+
window.addEventListener('resize', resizeCanvas);
|
| 214 |
+
resizeCanvas(); // Initial resize
|
| 215 |
+
|
| 216 |
+
// --- Mouse Tracking ---
|
| 217 |
+
canvas.addEventListener('mousemove', (e) => {
|
| 218 |
+
mouseX = e.clientX;
|
| 219 |
+
mouseY = e.clientY;
|
| 220 |
+
});
|
| 221 |
+
|
| 222 |
+
// --- Drawing Functions ---
|
| 223 |
+
function drawBackground() {
|
| 224 |
+
// Solid background
|
| 225 |
+
ctx.fillStyle = config.background.color;
|
| 226 |
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
| 227 |
+
|
| 228 |
+
// Geometric patterns
|
| 229 |
+
if (config.background.patternType !== "none") {
|
| 230 |
+
ctx.save();
|
| 231 |
+
ctx.globalAlpha = 0.2;
|
| 232 |
+
const scale = config.background.patternScale;
|
| 233 |
+
|
| 234 |
+
if (config.background.patternType === "grid") {
|
| 235 |
+
ctx.strokeStyle = "#000000";
|
| 236 |
+
ctx.lineWidth = 1;
|
| 237 |
+
for (let x = 0; x < canvas.width; x += scale) {
|
| 238 |
+
ctx.beginPath();
|
| 239 |
+
ctx.moveTo(x, 0);
|
| 240 |
+
ctx.lineTo(x, canvas.height);
|
| 241 |
+
ctx.stroke();
|
| 242 |
+
}
|
| 243 |
+
for (let y = 0; y < canvas.height; y += scale) {
|
| 244 |
+
ctx.beginPath();
|
| 245 |
+
ctx.moveTo(0, y);
|
| 246 |
+
ctx.lineTo(canvas.width, y);
|
| 247 |
+
ctx.stroke();
|
| 248 |
+
}
|
| 249 |
+
} else if (config.background.patternType === "dots") {
|
| 250 |
+
ctx.fillStyle = "#000000";
|
| 251 |
+
for (let x = 0; x < canvas.width; x += scale) {
|
| 252 |
+
for (let y = 0; y < canvas.height; y += scale) {
|
| 253 |
+
ctx.beginPath();
|
| 254 |
+
ctx.arc(x, y, 1, 0, Math.PI * 2);
|
| 255 |
+
ctx.fill();
|
| 256 |
+
}
|
| 257 |
+
}
|
| 258 |
+
} else if (config.background.patternType === "lines") {
|
| 259 |
+
ctx.strokeStyle = "#000000";
|
| 260 |
+
ctx.lineWidth = 1;
|
| 261 |
+
for (let x = 0; x < canvas.width; x += scale) {
|
| 262 |
+
ctx.beginPath();
|
| 263 |
+
ctx.moveTo(x, 0);
|
| 264 |
+
ctx.lineTo(x + scale/2, canvas.height);
|
| 265 |
+
ctx.stroke();
|
| 266 |
+
}
|
| 267 |
+
}
|
| 268 |
+
ctx.restore();
|
| 269 |
+
}
|
| 270 |
+
|
| 271 |
+
// Vignette effect
|
| 272 |
+
if (config.background.vignetteStrength > 0) {
|
| 273 |
+
const gradient = ctx.createRadialGradient(
|
| 274 |
+
canvas.width/2, canvas.height/2, 0,
|
| 275 |
+
canvas.width/2, canvas.height/2, Math.max(canvas.width, canvas.height)/2
|
| 276 |
+
);
|
| 277 |
+
gradient.addColorStop(0, 'rgba(0,0,0,0)');
|
| 278 |
+
gradient.addColorStop(1, `rgba(0,0,0,${config.background.vignetteStrength})`);
|
| 279 |
+
|
| 280 |
+
ctx.fillStyle = gradient;
|
| 281 |
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
| 282 |
+
}
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
function drawCircle() {
|
| 286 |
+
const centerX = canvas.width / 2;
|
| 287 |
+
const centerY = canvas.height / 2;
|
| 288 |
+
|
| 289 |
+
ctx.beginPath();
|
| 290 |
+
ctx.arc(centerX, centerY, config.circleRadius, 0, Math.PI * 2);
|
| 291 |
+
ctx.fillStyle = '#fff'; // White interior
|
| 292 |
+
ctx.fill();
|
| 293 |
+
ctx.strokeStyle = config.borderColor;
|
| 294 |
+
ctx.lineWidth = 1;
|
| 295 |
+
ctx.stroke();
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
function drawFieldLines(time) {
|
| 299 |
+
const centerX = canvas.width / 2;
|
| 300 |
+
const centerY = canvas.height / 2;
|
| 301 |
+
|
| 302 |
+
ctx.strokeStyle = config.lineColor;
|
| 303 |
+
|
| 304 |
+
// Calculate pulsing line width
|
| 305 |
+
const pulsingWidth =
|
| 306 |
+
config.lineWidth.base +
|
| 307 |
+
Math.sin(time * config.lineWidth.frequency) *
|
| 308 |
+
config.lineWidth.amplitude;
|
| 309 |
+
ctx.lineWidth = Math.max(config.lineWidth.min, pulsingWidth); // Ensure it doesn't go below minimum
|
| 310 |
+
|
| 311 |
+
for (let i = 0; i < config.numLines; i++) {
|
| 312 |
+
const startAngle = (i / config.numLines) * Math.PI * 2;
|
| 313 |
+
let currentX = centerX + config.circleRadius * Math.cos(startAngle);
|
| 314 |
+
let currentY = centerY + config.circleRadius * Math.sin(startAngle);
|
| 315 |
+
|
| 316 |
+
ctx.beginPath();
|
| 317 |
+
ctx.moveTo(currentX, currentY);
|
| 318 |
+
|
| 319 |
+
let distanceTraveled = 0;
|
| 320 |
+
// Per-line phase offset for waves to make them appear staggered
|
| 321 |
+
const lineWavePhaseOffset = (i / config.numLines) * config.wavePhaseSpread;
|
| 322 |
+
|
| 323 |
+
// Store the previous segment's direction to help calculate the perpendicular for waves
|
| 324 |
+
let prevDx = 0;
|
| 325 |
+
let prevDy = 0;
|
| 326 |
+
|
| 327 |
+
// Simulate line path
|
| 328 |
+
while (distanceTraveled < config.maxLineLength) {
|
| 329 |
+
let dx = 0;
|
| 330 |
+
let dy = 0;
|
| 331 |
+
|
| 332 |
+
// 1. Repulsion from circle center (makes lines go outwards)
|
| 333 |
+
const distFromCenter = Math.sqrt(
|
| 334 |
+
(currentX - centerX) ** 2 + (currentY - centerY) ** 2,
|
| 335 |
+
);
|
| 336 |
+
if (distFromCenter > 0) {
|
| 337 |
+
dx += ((currentX - centerX) / distFromCenter) * 0.5;
|
| 338 |
+
dy += ((currentY - centerY) / distFromCenter) * 0.5;
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
// 2. Influence from fixed poles
|
| 342 |
+
config.poles.forEach((pole) => {
|
| 343 |
+
const poleX = centerX + config.circleRadius * Math.cos(pole.angle);
|
| 344 |
+
const poleY = centerY + config.circleRadius * Math.sin(pole.angle);
|
| 345 |
+
const vecX = currentX - poleX;
|
| 346 |
+
const vecY = currentY - poleY;
|
| 347 |
+
const distToPole = Math.sqrt(vecX ** 2 + vecY ** 2);
|
| 348 |
+
|
| 349 |
+
if (distToPole > 10) {
|
| 350 |
+
// Avoid division by zero/large forces at exact pole
|
| 351 |
+
const forceMagnitude = pole.strength / distToPole;
|
| 352 |
+
if (pole.type === 'attract') {
|
| 353 |
+
dx -= vecX * forceMagnitude;
|
| 354 |
+
dy -= vecY * forceMagnitude;
|
| 355 |
+
} else {
|
| 356 |
+
// Repel
|
| 357 |
+
dx += vecX * forceMagnitude;
|
| 358 |
+
dy += vecY * forceMagnitude;
|
| 359 |
+
}
|
| 360 |
+
}
|
| 361 |
+
});
|
| 362 |
+
|
| 363 |
+
// 3. Influence from mouse position
|
| 364 |
+
const mouseVecX = currentX - mouseX;
|
| 365 |
+
const mouseVecY = currentY - mouseY;
|
| 366 |
+
const distToMouse = Math.sqrt(mouseVecX ** 2 + mouseVecY ** 2);
|
| 367 |
+
|
| 368 |
+
if (distToMouse > 5) {
|
| 369 |
+
// Mouse acts as an attractor (you can change this to repel)
|
| 370 |
+
const mouseForceMagnitude = 50 / distToMouse ** 1.5; // Inverse square or similar
|
| 371 |
+
dx -= mouseVecX * mouseForceMagnitude;
|
| 372 |
+
dy -= mouseVecY * mouseForceMagnitude;
|
| 373 |
+
}
|
| 374 |
+
|
| 375 |
+
// Normalize the direction vector before adding wave effect
|
| 376 |
+
let totalMagnitude = Math.sqrt(dx * dx + dy * dy);
|
| 377 |
+
if (totalMagnitude === 0) {
|
| 378 |
+
if (prevDx === 0 && prevDy === 0) break;
|
| 379 |
+
totalMagnitude = 1; // Prevent division by zero, will be normalized by prevDx/Dy
|
| 380 |
+
dx = prevDx;
|
| 381 |
+
dy = prevDy;
|
| 382 |
+
}
|
| 383 |
+
|
| 384 |
+
let unitDx = dx / totalMagnitude;
|
| 385 |
+
let unitDy = dy / totalMagnitude;
|
| 386 |
+
|
| 387 |
+
// --- Apply Wave Effect ---
|
| 388 |
+
// Calculate a vector perpendicular to the current line direction
|
| 389 |
+
const perpDx = -unitDy;
|
| 390 |
+
const perpDy = unitDx;
|
| 391 |
+
|
| 392 |
+
// Calculate the wave displacement using sine function
|
| 393 |
+
// The `distanceTraveled` makes the wave appear along the line
|
| 394 |
+
// `time` makes the wave travel, and `lineWavePhaseOffset` staggers lines
|
| 395 |
+
const waveDisplacement =
|
| 396 |
+
config.waveAmplitude *
|
| 397 |
+
Math.sin(
|
| 398 |
+
config.waveFrequency * distanceTraveled +
|
| 399 |
+
lineWavePhaseOffset +
|
| 400 |
+
time * config.waveSpeed,
|
| 401 |
+
);
|
| 402 |
+
|
| 403 |
+
// Add the wave displacement to the current direction
|
| 404 |
+
dx += perpDx * waveDisplacement;
|
| 405 |
+
dy += perpDy * waveDisplacement;
|
| 406 |
+
|
| 407 |
+
// Recalculate totalMagnitude after adding wave for the final step
|
| 408 |
+
const totalMagnitudeAfterWave = Math.sqrt(dx * dx + dy * dy);
|
| 409 |
+
if (totalMagnitudeAfterWave === 0) break;
|
| 410 |
+
|
| 411 |
+
const stepX = (dx / totalMagnitudeAfterWave) * config.lineSegmentLength;
|
| 412 |
+
const stepY = (dy / totalMagnitudeAfterWave) * config.lineSegmentLength;
|
| 413 |
+
|
| 414 |
+
currentX += stepX;
|
| 415 |
+
currentY += stepY;
|
| 416 |
+
distanceTraveled += config.lineSegmentLength;
|
| 417 |
+
|
| 418 |
+
// Store for next iteration if the line becomes stationary
|
| 419 |
+
prevDx = stepX;
|
| 420 |
+
prevDy = stepY;
|
| 421 |
+
|
| 422 |
+
// Stop if line gets too close to the circle center again
|
| 423 |
+
const currentDistFromCenter = Math.sqrt(
|
| 424 |
+
(currentX - centerX) ** 2 + (currentY - centerY) ** 2,
|
| 425 |
+
);
|
| 426 |
+
if (currentDistFromCenter < config.circleRadius - 5) {
|
| 427 |
+
break;
|
| 428 |
+
}
|
| 429 |
+
|
| 430 |
+
ctx.lineTo(currentX, currentY);
|
| 431 |
+
}
|
| 432 |
+
ctx.stroke();
|
| 433 |
+
}
|
| 434 |
+
}
|
| 435 |
+
|
| 436 |
+
// --- Control Panel Setup ---
|
| 437 |
+
function updateTextOverlay() {
|
| 438 |
+
textOverlay.innerHTML = `${config.text.line1}<br />${config.text.line2}`;
|
| 439 |
+
textOverlay.style.fontFamily = config.text.fontFamily;
|
| 440 |
+
textOverlay.style.fontSize = `${config.text.fontSize}px`;
|
| 441 |
+
textOverlay.style.color = config.text.color;
|
| 442 |
+
}
|
| 443 |
+
|
| 444 |
+
function setupControls() {
|
| 445 |
+
// Text controls
|
| 446 |
+
document.getElementById('textLine1').addEventListener('input', (e) => {
|
| 447 |
+
config.text.line1 = e.target.value;
|
| 448 |
+
updateTextOverlay();
|
| 449 |
+
});
|
| 450 |
+
document.getElementById('textLine2').addEventListener('input', (e) => {
|
| 451 |
+
config.text.line2 = e.target.value;
|
| 452 |
+
updateTextOverlay();
|
| 453 |
+
});
|
| 454 |
+
document.getElementById('fontFamily').addEventListener('change', (e) => {
|
| 455 |
+
config.text.fontFamily = e.target.value;
|
| 456 |
+
updateTextOverlay();
|
| 457 |
+
});
|
| 458 |
+
document.getElementById('fontSize').addEventListener('input', (e) => {
|
| 459 |
+
config.text.fontSize = e.target.value;
|
| 460 |
+
updateTextOverlay();
|
| 461 |
+
});
|
| 462 |
+
document.getElementById('textColor').addEventListener('input', (e) => {
|
| 463 |
+
config.text.color = e.target.value;
|
| 464 |
+
updateTextOverlay();
|
| 465 |
+
});
|
| 466 |
+
|
| 467 |
+
// Background controls
|
| 468 |
+
document.getElementById('bgColor').addEventListener('input', (e) => {
|
| 469 |
+
config.background.color = e.target.value;
|
| 470 |
+
});
|
| 471 |
+
document.getElementById('vignetteStrength').addEventListener('input', (e) => {
|
| 472 |
+
config.background.vignetteStrength = Number(e.target.value);
|
| 473 |
+
});
|
| 474 |
+
document.getElementById('patternType').addEventListener('change', (e) => {
|
| 475 |
+
config.background.patternType = e.target.value;
|
| 476 |
+
});
|
| 477 |
+
document.getElementById('patternScale').addEventListener('input', (e) => {
|
| 478 |
+
config.background.patternScale = Number(e.target.value);
|
| 479 |
+
});
|
| 480 |
+
|
| 481 |
+
// Animation controls
|
| 482 |
+
document.getElementById('animateRadius').addEventListener('change', (e) => {
|
| 483 |
+
config.animation.radius.enabled = e.target.checked;
|
| 484 |
+
});
|
| 485 |
+
document.getElementById('radiusSpeed').addEventListener('input', (e) => {
|
| 486 |
+
config.animation.radius.speed = Number(e.target.value);
|
| 487 |
+
});
|
| 488 |
+
document.getElementById('animateWaveAmp').addEventListener('change', (e) => {
|
| 489 |
+
config.animation.waveAmplitude.enabled = e.target.checked;
|
| 490 |
+
});
|
| 491 |
+
document.getElementById('waveAmpSpeed').addEventListener('input', (e) => {
|
| 492 |
+
config.animation.waveAmplitude.speed = Number(e.target.value);
|
| 493 |
+
});
|
| 494 |
+
|
| 495 |
+
document.getElementById('circleRadius').addEventListener('input', (e) => {
|
| 496 |
+
config.circleRadius = Number(e.target.value);
|
| 497 |
+
});
|
| 498 |
+
document.getElementById('borderColor').addEventListener('input', (e) => {
|
| 499 |
+
config.borderColor = e.target.value;
|
| 500 |
+
});
|
| 501 |
+
document.getElementById('lineColor').addEventListener('input', (e) => {
|
| 502 |
+
config.lineColor = e.target.value;
|
| 503 |
+
});
|
| 504 |
+
document.getElementById('numLines').addEventListener('input', (e) => {
|
| 505 |
+
config.numLines = Number(e.target.value);
|
| 506 |
+
});
|
| 507 |
+
document.getElementById('maxLineLength').addEventListener('input', (e) => {
|
| 508 |
+
config.maxLineLength = Number(e.target.value);
|
| 509 |
+
});
|
| 510 |
+
|
| 511 |
+
// Line width controls
|
| 512 |
+
document.getElementById('lineWidthBase').addEventListener('input', (e) => {
|
| 513 |
+
config.lineWidth.base = Number(e.target.value);
|
| 514 |
+
});
|
| 515 |
+
document.getElementById('lineWidthAmplitude').addEventListener('input', (e) => {
|
| 516 |
+
config.lineWidth.amplitude = Number(e.target.value);
|
| 517 |
+
});
|
| 518 |
+
document.getElementById('lineWidthFrequency').addEventListener('input', (e) => {
|
| 519 |
+
config.lineWidth.frequency = Number(e.target.value);
|
| 520 |
+
});
|
| 521 |
+
document.getElementById('lineWidthMin').addEventListener('input', (e) => {
|
| 522 |
+
config.lineWidth.min = Number(e.target.value);
|
| 523 |
+
});
|
| 524 |
+
|
| 525 |
+
// Wave controls
|
| 526 |
+
document.getElementById('waveAmplitude').addEventListener('input', (e) => {
|
| 527 |
+
config.waveAmplitude = Number(e.target.value);
|
| 528 |
+
});
|
| 529 |
+
document.getElementById('waveFrequency').addEventListener('input', (e) => {
|
| 530 |
+
config.waveFrequency = Number(e.target.value);
|
| 531 |
+
});
|
| 532 |
+
document.getElementById('waveSpeed').addEventListener('input', (e) => {
|
| 533 |
+
config.waveSpeed = Number(e.target.value);
|
| 534 |
+
});
|
| 535 |
+
document.getElementById('wavePhaseSpread').addEventListener('input', (e) => {
|
| 536 |
+
config.wavePhaseSpread = Number(e.target.value);
|
| 537 |
+
});
|
| 538 |
+
}
|
| 539 |
+
setupControls();
|
| 540 |
+
|
| 541 |
+
// --- Animation Loop ---
|
| 542 |
+
function animate() {
|
| 543 |
+
animationTime += 0.05; // Increment time for animation, adjust speed here
|
| 544 |
+
|
| 545 |
+
// Apply LFO animations
|
| 546 |
+
if (config.animation.radius.enabled) {
|
| 547 |
+
config.circleRadius = 450 + Math.sin(animationTime * config.animation.radius.speed) * 100;
|
| 548 |
+
}
|
| 549 |
+
if (config.animation.waveAmplitude.enabled) {
|
| 550 |
+
config.waveAmplitude = 15 + Math.sin(animationTime * config.animation.waveAmplitude.speed) * 10;
|
| 551 |
+
}
|
| 552 |
+
|
| 553 |
+
ctx.clearRect(0, 0, canvas.width, canvas.height); // Clear canvas
|
| 554 |
+
drawBackground();
|
| 555 |
+
drawCircle();
|
| 556 |
+
drawFieldLines(animationTime); // Pass current time to drawing function
|
| 557 |
+
requestAnimationFrame(animate);
|
| 558 |
+
}
|
| 559 |
+
|
| 560 |
+
// Start the animation
|
| 561 |
+
animate();
|
| 562 |
+
</script>
|
| 563 |
+
<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=ninjacricket/cat" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 564 |
+
</html>
|