|
|
<!DOCTYPE html> |
|
|
<html lang="en"> |
|
|
<head> |
|
|
<meta charset="UTF-8"> |
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
|
<title>TIMELINK v1.0 - by webXOS</title> |
|
|
|
|
|
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script> |
|
|
<script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/controls/OrbitControls.min.js"></script> |
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script> |
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.5/FileSaver.min.js"></script> |
|
|
|
|
|
<style> |
|
|
* { |
|
|
margin: 0; |
|
|
padding: 0; |
|
|
box-sizing: border-box; |
|
|
} |
|
|
|
|
|
body { |
|
|
font-family: 'Courier New', monospace; |
|
|
background: #000000; |
|
|
color: #00ff00; |
|
|
overflow: hidden; |
|
|
height: 100vh; |
|
|
width: 100vw; |
|
|
} |
|
|
|
|
|
|
|
|
#threeCanvas { |
|
|
position: fixed; |
|
|
top: 0; |
|
|
left: 0; |
|
|
width: 100vw; |
|
|
height: 100vh; |
|
|
z-index: 1; |
|
|
} |
|
|
|
|
|
|
|
|
#ui-overlay { |
|
|
position: fixed; |
|
|
top: 0; |
|
|
left: 0; |
|
|
width: 100vw; |
|
|
height: 100vh; |
|
|
z-index: 2; |
|
|
pointer-events: none; |
|
|
} |
|
|
|
|
|
|
|
|
#minimal-header { |
|
|
position: absolute; |
|
|
top: 0; |
|
|
left: 0; |
|
|
width: 100%; |
|
|
background: rgba(0, 20, 0, 0.85); |
|
|
padding: 10px 20px; |
|
|
display: flex; |
|
|
justify-content: space-between; |
|
|
align-items: center; |
|
|
border-bottom: 1px solid #00ff00; |
|
|
backdrop-filter: blur(5px); |
|
|
pointer-events: auto; |
|
|
height: 50px; |
|
|
} |
|
|
|
|
|
.minimal-logo { |
|
|
font-size: 16px; |
|
|
font-weight: bold; |
|
|
color: #00ff00; |
|
|
text-shadow: 0 0 10px #00ff00; |
|
|
} |
|
|
|
|
|
.minimal-stats { |
|
|
display: flex; |
|
|
gap: 20px; |
|
|
font-size: 12px; |
|
|
} |
|
|
|
|
|
.stat-item { |
|
|
display: flex; |
|
|
flex-direction: column; |
|
|
align-items: center; |
|
|
} |
|
|
|
|
|
.stat-label { |
|
|
color: #00cc00; |
|
|
font-size: 10px; |
|
|
} |
|
|
|
|
|
.stat-value { |
|
|
color: #00ff00; |
|
|
font-weight: bold; |
|
|
} |
|
|
|
|
|
|
|
|
#control-panel { |
|
|
position: absolute; |
|
|
top: 60px; |
|
|
left: 20px; |
|
|
width: 200px; |
|
|
background: rgba(0, 30, 0, 0.95); |
|
|
border: 2px solid #00ff00; |
|
|
border-radius: 8px; |
|
|
padding: 15px; |
|
|
backdrop-filter: blur(5px); |
|
|
pointer-events: auto; |
|
|
} |
|
|
|
|
|
.control-title { |
|
|
color: #00ff00; |
|
|
font-size: 14px; |
|
|
margin-bottom: 15px; |
|
|
text-align: center; |
|
|
border-bottom: 1px solid rgba(0, 255, 0, 0.3); |
|
|
padding-bottom: 5px; |
|
|
} |
|
|
|
|
|
.shape-selector { |
|
|
display: flex; |
|
|
flex-direction: column; |
|
|
gap: 8px; |
|
|
margin-bottom: 15px; |
|
|
} |
|
|
|
|
|
.shape-btn { |
|
|
background: rgba(0, 40, 0, 0.7); |
|
|
border: 1px solid #00ff00; |
|
|
color: #00ff00; |
|
|
padding: 8px; |
|
|
font-size: 12px; |
|
|
cursor: pointer; |
|
|
border-radius: 4px; |
|
|
transition: all 0.3s; |
|
|
text-align: center; |
|
|
} |
|
|
|
|
|
.shape-btn:hover { |
|
|
background: rgba(0, 255, 0, 0.1); |
|
|
box-shadow: 0 0 10px #00ff00; |
|
|
} |
|
|
|
|
|
.shape-btn.active { |
|
|
background: rgba(0, 255, 0, 0.2); |
|
|
box-shadow: 0 0 15px #00ff00; |
|
|
border-color: #00ffff; |
|
|
} |
|
|
|
|
|
|
|
|
#central-generate-btn { |
|
|
position: fixed; |
|
|
bottom: 40px; |
|
|
left: 50%; |
|
|
transform: translateX(-50%); |
|
|
width: 280px; |
|
|
background: linear-gradient(45deg, #006600, #00cc00); |
|
|
border: none; |
|
|
color: white; |
|
|
padding: 20px 40px; |
|
|
font-family: 'Courier New', monospace; |
|
|
font-size: 18px; |
|
|
font-weight: bold; |
|
|
cursor: pointer; |
|
|
border-radius: 12px; |
|
|
text-transform: uppercase; |
|
|
letter-spacing: 2px; |
|
|
transition: all 0.3s; |
|
|
z-index: 10; |
|
|
pointer-events: auto; |
|
|
box-shadow: 0 0 30px rgba(0, 255, 0, 0.5); |
|
|
text-align: center; |
|
|
} |
|
|
|
|
|
#central-generate-btn:hover { |
|
|
background: linear-gradient(45deg, #00cc00, #00ff00); |
|
|
box-shadow: 0 0 40px rgba(0, 255, 0, 0.8); |
|
|
transform: translateX(-50%) scale(1.05); |
|
|
} |
|
|
|
|
|
#central-generate-btn.generating { |
|
|
background: linear-gradient(45deg, #cc0000, #ff0000); |
|
|
animation: pulse 2s infinite; |
|
|
box-shadow: 0 0 40px rgba(255, 0, 0, 0.6); |
|
|
} |
|
|
|
|
|
#central-generate-btn.paused { |
|
|
background: linear-gradient(45deg, #666600, #cccc00); |
|
|
box-shadow: 0 0 30px rgba(204, 204, 0, 0.6); |
|
|
} |
|
|
|
|
|
|
|
|
.time-control { |
|
|
margin-top: 10px; |
|
|
padding-top: 10px; |
|
|
border-top: 1px solid rgba(0, 255, 0, 0.3); |
|
|
} |
|
|
|
|
|
.time-slider { |
|
|
width: 100%; |
|
|
margin: 10px 0; |
|
|
} |
|
|
|
|
|
.time-value { |
|
|
text-align: center; |
|
|
font-size: 12px; |
|
|
color: #00cc00; |
|
|
margin-top: 5px; |
|
|
} |
|
|
|
|
|
|
|
|
#export-panel { |
|
|
position: absolute; |
|
|
bottom: 20px; |
|
|
right: 20px; |
|
|
width: 200px; |
|
|
background: rgba(0, 30, 0, 0.95); |
|
|
border: 2px solid #00ff00; |
|
|
border-radius: 8px; |
|
|
padding: 15px; |
|
|
backdrop-filter: blur(5px); |
|
|
pointer-events: auto; |
|
|
} |
|
|
|
|
|
.export-btn { |
|
|
width: 100%; |
|
|
background: rgba(0, 60, 0, 0.8); |
|
|
border: 1px solid #00ff00; |
|
|
color: #00ff00; |
|
|
padding: 10px; |
|
|
font-family: 'Courier New', monospace; |
|
|
font-size: 12px; |
|
|
cursor: pointer; |
|
|
border-radius: 4px; |
|
|
margin: 5px 0; |
|
|
transition: all 0.3s; |
|
|
} |
|
|
|
|
|
.export-btn:hover { |
|
|
background: rgba(0, 255, 0, 0.1); |
|
|
box-shadow: 0 0 10px #00ff00; |
|
|
} |
|
|
|
|
|
.export-btn.ready { |
|
|
background: linear-gradient(45deg, #006600, #00cc00); |
|
|
color: white; |
|
|
font-weight: bold; |
|
|
} |
|
|
|
|
|
|
|
|
#fullscreen-btn { |
|
|
position: absolute; |
|
|
top: 10px; |
|
|
right: 10px; |
|
|
background: rgba(0, 40, 0, 0.8); |
|
|
border: 1px solid #00ff00; |
|
|
color: #00ff00; |
|
|
padding: 6px 12px; |
|
|
font-family: 'Courier New', monospace; |
|
|
font-size: 11px; |
|
|
cursor: pointer; |
|
|
border-radius: 4px; |
|
|
z-index: 3; |
|
|
pointer-events: auto; |
|
|
transition: all 0.3s; |
|
|
} |
|
|
|
|
|
#fullscreen-btn:hover { |
|
|
background: rgba(0, 255, 0, 0.1); |
|
|
box-shadow: 0 0 10px #00ff00; |
|
|
} |
|
|
|
|
|
|
|
|
#emergency-btn { |
|
|
position: absolute; |
|
|
bottom: 20px; |
|
|
left: 20px; |
|
|
background: rgba(60, 0, 0, 0.8); |
|
|
border: 1px solid #ff0000; |
|
|
color: #ff0000; |
|
|
padding: 10px 15px; |
|
|
font-family: 'Courier New', monospace; |
|
|
font-size: 12px; |
|
|
cursor: pointer; |
|
|
border-radius: 4px; |
|
|
pointer-events: auto; |
|
|
transition: all 0.3s; |
|
|
} |
|
|
|
|
|
#emergency-btn:hover { |
|
|
background: rgba(255, 0, 0, 0.1); |
|
|
box-shadow: 0 0 15px #ff0000; |
|
|
} |
|
|
|
|
|
|
|
|
#progress-display { |
|
|
position: absolute; |
|
|
top: 60px; |
|
|
right: 20px; |
|
|
width: 200px; |
|
|
background: rgba(0, 30, 0, 0.95); |
|
|
border: 2px solid #00ff00; |
|
|
border-radius: 8px; |
|
|
padding: 15px; |
|
|
backdrop-filter: blur(5px); |
|
|
pointer-events: auto; |
|
|
} |
|
|
|
|
|
.progress-item { |
|
|
margin: 8px 0; |
|
|
} |
|
|
|
|
|
.progress-label { |
|
|
display: flex; |
|
|
justify-content: space-between; |
|
|
font-size: 11px; |
|
|
color: #00cc00; |
|
|
margin-bottom: 3px; |
|
|
} |
|
|
|
|
|
.progress-bar { |
|
|
width: 100%; |
|
|
height: 6px; |
|
|
background: rgba(0, 0, 0, 0.5); |
|
|
border: 1px solid #00ff00; |
|
|
border-radius: 3px; |
|
|
overflow: hidden; |
|
|
} |
|
|
|
|
|
.progress-fill { |
|
|
height: 100%; |
|
|
background: linear-gradient(90deg, #00ff00, #00cc00); |
|
|
width: 0%; |
|
|
transition: width 0.5s ease; |
|
|
} |
|
|
|
|
|
|
|
|
.crystal-info { |
|
|
font-size: 10px; |
|
|
color: #00ff00; |
|
|
text-align: center; |
|
|
margin-top: 10px; |
|
|
padding-top: 10px; |
|
|
border-top: 1px solid rgba(0, 255, 0, 0.3); |
|
|
} |
|
|
|
|
|
|
|
|
#capture-panel { |
|
|
position: absolute; |
|
|
top: 280px; |
|
|
left: 20px; |
|
|
width: 200px; |
|
|
background: rgba(0, 30, 0, 0.95); |
|
|
border: 2px solid #00ff00; |
|
|
border-radius: 8px; |
|
|
padding: 15px; |
|
|
backdrop-filter: blur(5px); |
|
|
pointer-events: auto; |
|
|
} |
|
|
|
|
|
.capture-controls { |
|
|
display: flex; |
|
|
gap: 10px; |
|
|
margin-top: 10px; |
|
|
} |
|
|
|
|
|
.capture-btn { |
|
|
flex: 1; |
|
|
background: rgba(0, 60, 0, 0.8); |
|
|
border: 1px solid #00ff00; |
|
|
color: #00ff00; |
|
|
padding: 8px; |
|
|
font-size: 11px; |
|
|
cursor: pointer; |
|
|
border-radius: 4px; |
|
|
text-align: center; |
|
|
} |
|
|
|
|
|
.capture-btn:hover { |
|
|
background: rgba(0, 255, 0, 0.1); |
|
|
box-shadow: 0 0 10px #00ff00; |
|
|
} |
|
|
|
|
|
|
|
|
#system-warning { |
|
|
position: fixed; |
|
|
top: 50%; |
|
|
left: 50%; |
|
|
transform: translate(-50%, -50%); |
|
|
background: rgba(0, 20, 0, 0.95); |
|
|
border: 2px solid #ff0000; |
|
|
padding: 30px; |
|
|
color: #ff0000; |
|
|
text-align: center; |
|
|
display: none; |
|
|
z-index: 100; |
|
|
max-width: 400px; |
|
|
border-radius: 8px; |
|
|
backdrop-filter: blur(10px); |
|
|
pointer-events: auto; |
|
|
} |
|
|
|
|
|
|
|
|
#notification { |
|
|
position: fixed; |
|
|
top: 50%; |
|
|
left: 50%; |
|
|
transform: translate(-50%, -50%); |
|
|
background: rgba(0, 30, 0, 0.95); |
|
|
border: 2px solid #00ff00; |
|
|
padding: 30px; |
|
|
color: #00ff00; |
|
|
text-align: center; |
|
|
display: none; |
|
|
z-index: 100; |
|
|
max-width: 400px; |
|
|
border-radius: 8px; |
|
|
backdrop-filter: blur(10px); |
|
|
pointer-events: auto; |
|
|
} |
|
|
|
|
|
|
|
|
@keyframes pulse { |
|
|
0%, 100% { opacity: 1; } |
|
|
50% { opacity: 0.7; } |
|
|
} |
|
|
|
|
|
@keyframes glow { |
|
|
0%, 100% { box-shadow: 0 0 10px #00ff00; } |
|
|
50% { box-shadow: 0 0 20px #00ff00, 0 0 30px #00ff00; } |
|
|
} |
|
|
|
|
|
@keyframes float { |
|
|
0%, 100% { transform: translateX(-50%) translateY(0px); } |
|
|
50% { transform: translateX(-50%) translateY(-10px); } |
|
|
} |
|
|
|
|
|
.glow { |
|
|
animation: glow 2s infinite; |
|
|
} |
|
|
|
|
|
.float { |
|
|
animation: float 3s ease-in-out infinite; |
|
|
} |
|
|
|
|
|
|
|
|
#time-display { |
|
|
position: absolute; |
|
|
top: 120px; |
|
|
left: 50%; |
|
|
transform: translateX(-50%); |
|
|
background: rgba(0, 30, 0, 0.9); |
|
|
border: 2px solid #00ff00; |
|
|
padding: 10px 20px; |
|
|
border-radius: 8px; |
|
|
min-width: 200px; |
|
|
backdrop-filter: blur(5px); |
|
|
pointer-events: auto; |
|
|
text-align: center; |
|
|
} |
|
|
|
|
|
.time-scale-value { |
|
|
font-size: 24px; |
|
|
color: #00ff00; |
|
|
font-weight: bold; |
|
|
font-family: monospace; |
|
|
margin: 5px 0; |
|
|
text-shadow: 0 0 10px #00ff00; |
|
|
} |
|
|
|
|
|
.time-label { |
|
|
color: #00cc00; |
|
|
font-size: 10px; |
|
|
letter-spacing: 1px; |
|
|
} |
|
|
</style> |
|
|
</head> |
|
|
<body> |
|
|
<canvas id="threeCanvas"></canvas> |
|
|
|
|
|
<div id="ui-overlay"> |
|
|
|
|
|
<div id="minimal-header"> |
|
|
<div class="minimal-logo">TIMELINK // by webXOS</div> |
|
|
<div class="minimal-stats"> |
|
|
<div class="stat-item"> |
|
|
<div class="stat-label">CRYSTALS</div> |
|
|
<div class="stat-value" id="crystalCount">0</div> |
|
|
</div> |
|
|
<div class="stat-item"> |
|
|
<div class="stat-label">IMAGES</div> |
|
|
<div class="stat-value" id="imageCount">0</div> |
|
|
</div> |
|
|
<div class="stat-item"> |
|
|
<div class="stat-label">FPS</div> |
|
|
<div class="stat-value" id="fpsCounter">60</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div id="control-panel"> |
|
|
<div class="control-title">CRYSTAL SHAPES</div> |
|
|
|
|
|
<div class="shape-selector"> |
|
|
<button class="shape-btn active" onclick="selectShape('quantum_spiral')">🌀 QUANTUM SPIRAL</button> |
|
|
<button class="shape-btn" onclick="selectShape('fractal_matrix')">⬢ FRACTAL MATRIX</button> |
|
|
<button class="shape-btn" onclick="selectShape('neural_lattice')">⊞ NEURAL LATTICE</button> |
|
|
<button class="shape-btn" onclick="selectShape('temporal_ring')">⭕ TEMPORAL RING</button> |
|
|
</div> |
|
|
|
|
|
<div class="time-control"> |
|
|
<div class="time-label">TIME SCALE</div> |
|
|
<input type="range" id="timeScale" class="time-slider" min="0.1" max="5.0" value="1.0" step="0.1"> |
|
|
<div class="time-value" id="timeScaleValue">1.0x</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div id="capture-panel"> |
|
|
<div class="control-title">IMAGE CAPTURE</div> |
|
|
|
|
|
<div class="progress-item"> |
|
|
<div class="progress-label"> |
|
|
<span>CAPTURED</span> |
|
|
<span id="captureCount">0</span> |
|
|
</div> |
|
|
<div class="progress-bar"> |
|
|
<div id="captureProgress" class="progress-fill"></div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<div class="capture-controls"> |
|
|
<button class="capture-btn" onclick="captureImage()">📸 CAPTURE</button> |
|
|
<button class="capture-btn" onclick="toggleAutoCapture()" id="autoCaptureBtn">⚙ AUTO: OFF</button> |
|
|
</div> |
|
|
|
|
|
<div class="crystal-info"> |
|
|
<div>Quality: HD (1280x720)</div> |
|
|
<div>Format: PNG + JSON</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div id="progress-display"> |
|
|
<div class="control-title">GENERATION PROGRESS</div> |
|
|
|
|
|
<div class="progress-item"> |
|
|
<div class="progress-label"> |
|
|
<span>CURRENT CRYSTAL</span> |
|
|
<span id="crystalProgressText">0%</span> |
|
|
</div> |
|
|
<div class="progress-bar"> |
|
|
<div id="crystalProgress" class="progress-fill"></div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<div class="progress-item"> |
|
|
<div class="progress-label"> |
|
|
<span>DATASET SIZE</span> |
|
|
<span id="datasetSize">0 MB</span> |
|
|
</div> |
|
|
<div class="progress-bar"> |
|
|
<div id="datasetProgress" class="progress-fill"></div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<div class="crystal-info"> |
|
|
<div id="currentCrystalInfo">READY TO START</div> |
|
|
<div id="vertexCount">0 vertices / 0 edges</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div id="export-panel"> |
|
|
<div class="control-title">DATASET EXPORT</div> |
|
|
|
|
|
<button class="export-btn" onclick="exportCurrentCrystal()"> |
|
|
💾 EXPORT CURRENT |
|
|
</button> |
|
|
|
|
|
<button class="export-btn" onclick="exportCompleteDataset()"> |
|
|
📦 EXPORT COMPLETE |
|
|
</button> |
|
|
|
|
|
<button class="export-btn" onclick="exportHuggingFace()"> |
|
|
🤗 HUGGING FACE |
|
|
</button> |
|
|
|
|
|
<div class="crystal-info" style="margin-top: 10px;"> |
|
|
<div>Includes: Images + Data</div> |
|
|
<div>Ready: <span id="exportReady">NO</span></div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<button id="central-generate-btn" onclick="toggleAutomatedGeneration()" class="float"> |
|
|
⚡ GENERATE CRYSTALS |
|
|
</button> |
|
|
|
|
|
|
|
|
<button id="fullscreen-btn" onclick="toggleFullscreen()">⛶ FULLSCREEN</button> |
|
|
|
|
|
|
|
|
<button id="emergency-btn" onclick="emergencyStop()">🛑 EMERGENCY STOP</button> |
|
|
|
|
|
|
|
|
<div id="time-display"> |
|
|
<div class="time-label">AUTOMATED GENERATOR</div> |
|
|
<div class="time-scale-value" id="timeDisplay">00:00:00</div> |
|
|
<div class="time-label">TOTAL TIME: <span id="totalTime">0s</span></div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div id="system-warning"> |
|
|
<h3>⚠️ SYSTEM LIMIT REACHED</h3> |
|
|
<p>Memory usage approaching browser limits.</p> |
|
|
<p>Auto-exporting current dataset...</p> |
|
|
<div style="margin-top: 20px;"> |
|
|
<button onclick="continueGeneration()" style="background: rgba(0,60,0,0.8); border: 1px solid #00ff00; color: #00ff00; padding: 10px 20px; cursor: pointer; margin: 5px;"> |
|
|
CONTINUE |
|
|
</button> |
|
|
<button onclick="emergencyStop()" style="background: rgba(60,0,0,0.8); border: 1px solid #ff0000; color: #ff0000; padding: 10px 20px; cursor: pointer; margin: 5px;"> |
|
|
STOP |
|
|
</button> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div id="notification"> |
|
|
<h3 id="notificationTitle">EXPORTING</h3> |
|
|
<p id="notificationMessage">Preparing dataset...</p> |
|
|
<div class="progress-bar" style="margin: 20px auto; width: 80%;"> |
|
|
<div id="notificationProgress" class="progress-fill"></div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<script> |
|
|
|
|
|
let scene, camera, renderer, controls; |
|
|
let currentCrystal = null; |
|
|
let isGenerating = false; |
|
|
let generationInterval = null; |
|
|
let animationId = null; |
|
|
let isFullscreen = false; |
|
|
let autoCaptureEnabled = false; |
|
|
|
|
|
|
|
|
let generationState = { |
|
|
active: false, |
|
|
crystalCount: 0, |
|
|
currentShape: 'quantum_spiral', |
|
|
timeScale: 1.0, |
|
|
startTime: 0, |
|
|
totalGenerationTime: 0, |
|
|
currentCrystal: { |
|
|
vertices: [], |
|
|
edges: [], |
|
|
size: 0, |
|
|
targetSize: 200, |
|
|
currentStep: 0, |
|
|
maxSteps: 300, |
|
|
color: new THREE.Color(0x00ff00), |
|
|
shape: 'quantum_spiral' |
|
|
} |
|
|
}; |
|
|
|
|
|
|
|
|
let dataset = { |
|
|
crystals: [], |
|
|
currentCrystalData: [], |
|
|
capturedImages: [], |
|
|
autoCaptureCount: 0, |
|
|
manualCaptureCount: 0, |
|
|
totalImages: 0, |
|
|
isExporting: false, |
|
|
lastExportTime: 0 |
|
|
}; |
|
|
|
|
|
|
|
|
let systemMonitor = { |
|
|
fps: 60, |
|
|
memoryUsage: 0, |
|
|
performanceLevel: 'high', |
|
|
frameCount: 0, |
|
|
lastFrameTime: performance.now(), |
|
|
lastCleanup: 0, |
|
|
warningShown: false |
|
|
}; |
|
|
|
|
|
|
|
|
const SHAPE_COLORS = { |
|
|
quantum_spiral: [0x00ff00, 0x00cc00, 0x009900], |
|
|
fractal_matrix: [0x00ffff, 0x00cccc, 0x009999], |
|
|
neural_lattice: [0xff00ff, 0xcc00cc, 0x990099], |
|
|
temporal_ring: [0xffff00, 0xcccc00, 0x999900] |
|
|
}; |
|
|
|
|
|
|
|
|
function initThreeJS() { |
|
|
try { |
|
|
const canvas = document.getElementById('threeCanvas'); |
|
|
|
|
|
|
|
|
scene = new THREE.Scene(); |
|
|
scene.background = new THREE.Color(0x000000); |
|
|
|
|
|
|
|
|
const width = window.innerWidth; |
|
|
const height = window.innerHeight; |
|
|
camera = new THREE.PerspectiveCamera(75, width / height, 0.1, 5000); |
|
|
camera.position.set(0, 150, 300); |
|
|
|
|
|
|
|
|
renderer = new THREE.WebGLRenderer({ |
|
|
canvas: canvas, |
|
|
antialias: true, |
|
|
alpha: true, |
|
|
preserveDrawingBuffer: true |
|
|
}); |
|
|
renderer.setSize(width, height); |
|
|
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2)); |
|
|
|
|
|
|
|
|
controls = new THREE.OrbitControls(camera, renderer.domElement); |
|
|
controls.enableDamping = true; |
|
|
controls.dampingFactor = 0.05; |
|
|
controls.minDistance = 50; |
|
|
controls.maxDistance = 1000; |
|
|
|
|
|
|
|
|
const ambientLight = new THREE.AmbientLight(0xffffff, 0.5); |
|
|
scene.add(ambientLight); |
|
|
|
|
|
const directionalLight1 = new THREE.DirectionalLight(0xffffff, 0.8); |
|
|
directionalLight1.position.set(100, 200, 100); |
|
|
scene.add(directionalLight1); |
|
|
|
|
|
const directionalLight2 = new THREE.DirectionalLight(0xffffff, 0.4); |
|
|
directionalLight2.position.set(-100, -200, -100); |
|
|
scene.add(directionalLight2); |
|
|
|
|
|
|
|
|
createEnhancedBackground(); |
|
|
|
|
|
console.log("TIMELINK: Three.js initialized with enhanced visuals"); |
|
|
return true; |
|
|
|
|
|
} catch (error) { |
|
|
console.error("TIMELINK: Three.js error:", error); |
|
|
showNotification("ERROR", "Graphics system initialization failed"); |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
function createEnhancedBackground() { |
|
|
|
|
|
createParticleLayer(5000, 500, 1000, 0x00ff00, 0.3); |
|
|
createParticleLayer(3000, 1000, 2000, 0x00ffff, 0.2); |
|
|
createParticleLayer(2000, 2000, 4000, 0xff00ff, 0.1); |
|
|
|
|
|
|
|
|
const glowGeometry = new THREE.SphereGeometry(10, 32, 32); |
|
|
const glowMaterial = new THREE.MeshBasicMaterial({ |
|
|
color: 0x00ff00, |
|
|
transparent: true, |
|
|
opacity: 0.2, |
|
|
wireframe: true |
|
|
}); |
|
|
const centralGlow = new THREE.Mesh(glowGeometry, glowMaterial); |
|
|
scene.add(centralGlow); |
|
|
} |
|
|
|
|
|
function createParticleLayer(count, minRadius, maxRadius, baseColor, opacity) { |
|
|
const geometry = new THREE.BufferGeometry(); |
|
|
const positions = new Float32Array(count * 3); |
|
|
const colors = new Float32Array(count * 3); |
|
|
const sizes = new Float32Array(count); |
|
|
|
|
|
const color = new THREE.Color(baseColor); |
|
|
|
|
|
for (let i = 0; i < count * 3; i += 3) { |
|
|
const radius = minRadius + Math.random() * (maxRadius - minRadius); |
|
|
const theta = Math.random() * Math.PI * 2; |
|
|
const phi = Math.acos(2 * Math.random() - 1); |
|
|
|
|
|
positions[i] = radius * Math.sin(phi) * Math.cos(theta); |
|
|
positions[i + 1] = radius * Math.sin(phi) * Math.sin(theta); |
|
|
positions[i + 2] = radius * Math.cos(phi); |
|
|
|
|
|
|
|
|
const colorVariation = Math.random() * 0.3; |
|
|
colors[i] = color.r + colorVariation; |
|
|
colors[i + 1] = color.g + colorVariation; |
|
|
colors[i + 2] = color.b + colorVariation; |
|
|
|
|
|
sizes[i/3] = 0.5 + Math.random() * 2; |
|
|
} |
|
|
|
|
|
geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3)); |
|
|
geometry.setAttribute('color', new THREE.BufferAttribute(colors, 3)); |
|
|
geometry.setAttribute('size', new THREE.BufferAttribute(sizes, 1)); |
|
|
|
|
|
const material = new THREE.PointsMaterial({ |
|
|
size: 1.5, |
|
|
vertexColors: true, |
|
|
transparent: true, |
|
|
opacity: opacity, |
|
|
sizeAttenuation: true |
|
|
}); |
|
|
|
|
|
const particles = new THREE.Points(geometry, material); |
|
|
scene.add(particles); |
|
|
|
|
|
|
|
|
if (!window.particleLayers) window.particleLayers = []; |
|
|
window.particleLayers.push(particles); |
|
|
} |
|
|
|
|
|
|
|
|
function toggleAutomatedGeneration() { |
|
|
if (generationState.active) { |
|
|
pauseGeneration(); |
|
|
} else { |
|
|
startGeneration(); |
|
|
} |
|
|
} |
|
|
|
|
|
function selectShape(shape) { |
|
|
generationState.currentShape = shape; |
|
|
updateShapeButtons(); |
|
|
|
|
|
if (generationState.active) { |
|
|
showNotification("SHAPE CHANGED", `Next crystal will be ${formatShapeName(shape)}`); |
|
|
} else { |
|
|
showNotification("SHAPE SELECTED", `${formatShapeName(shape)} ready for generation`); |
|
|
} |
|
|
} |
|
|
|
|
|
function formatShapeName(shape) { |
|
|
return shape.split('_').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' '); |
|
|
} |
|
|
|
|
|
|
|
|
function startGeneration() { |
|
|
if (generationState.active) return; |
|
|
|
|
|
console.log("TIMELINK: Starting automated crystal generation..."); |
|
|
|
|
|
generationState.active = true; |
|
|
generationState.startTime = Date.now(); |
|
|
generationState.crystalCount = 0; |
|
|
|
|
|
|
|
|
const centralBtn = document.getElementById('central-generate-btn'); |
|
|
centralBtn.textContent = '⏸ STOP GENERATION'; |
|
|
centralBtn.classList.add('generating'); |
|
|
centralBtn.classList.remove('paused'); |
|
|
centralBtn.classList.remove('float'); |
|
|
|
|
|
|
|
|
initializeCrystal(); |
|
|
|
|
|
|
|
|
generationInterval = setInterval(growCrystalStep, 50); |
|
|
|
|
|
|
|
|
centralBtn.style.animation = 'none'; |
|
|
setTimeout(() => { |
|
|
centralBtn.style.animation = 'pulse 2s infinite'; |
|
|
}, 100); |
|
|
|
|
|
showNotification("GENERATION STARTED", `Automated ${formatShapeName(generationState.currentShape)} crystal generation active`); |
|
|
} |
|
|
|
|
|
function pauseGeneration() { |
|
|
if (!generationState.active) return; |
|
|
|
|
|
console.log("TIMELINK: Pausing generation"); |
|
|
|
|
|
generationState.active = false; |
|
|
clearInterval(generationInterval); |
|
|
generationInterval = null; |
|
|
|
|
|
|
|
|
const centralBtn = document.getElementById('central-generate-btn'); |
|
|
centralBtn.textContent = '▶ RESUME GENERATION'; |
|
|
centralBtn.classList.remove('generating'); |
|
|
centralBtn.classList.add('paused'); |
|
|
centralBtn.classList.add('float'); |
|
|
|
|
|
|
|
|
centralBtn.style.animation = 'float 3s ease-in-out infinite'; |
|
|
|
|
|
showNotification("GENERATION PAUSED", "Click RESUME to continue automated generation"); |
|
|
} |
|
|
|
|
|
function initializeCrystal() { |
|
|
|
|
|
if (currentCrystal) { |
|
|
scene.remove(currentCrystal); |
|
|
currentCrystal = null; |
|
|
} |
|
|
|
|
|
|
|
|
generationState.currentCrystal = { |
|
|
vertices: [], |
|
|
edges: [], |
|
|
size: 0, |
|
|
targetSize: 200, |
|
|
currentStep: 0, |
|
|
maxSteps: 300, |
|
|
color: new THREE.Color(SHAPE_COLORS[generationState.currentShape][0]), |
|
|
shape: generationState.currentShape |
|
|
}; |
|
|
|
|
|
dataset.currentCrystalData = []; |
|
|
|
|
|
|
|
|
generationState.currentCrystal.vertices.push({ |
|
|
x: 0, y: 0, z: 0, |
|
|
connections: [], |
|
|
generation: 0, |
|
|
energy: 1.0, |
|
|
color: generationState.currentCrystal.color.getHex(), |
|
|
shape: generationState.currentShape, |
|
|
temporalPhase: null |
|
|
}); |
|
|
|
|
|
|
|
|
const colors = SHAPE_COLORS[generationState.currentShape]; |
|
|
generationState.currentCrystal.color = new THREE.Color(colors[Math.floor(Math.random() * colors.length)]); |
|
|
|
|
|
updateCrystalInfo(); |
|
|
updateCrystalProgress(0); |
|
|
|
|
|
console.log(`TIMELINK: Initialized ${generationState.currentShape} crystal`); |
|
|
} |
|
|
|
|
|
function growCrystalStep() { |
|
|
if (!generationState.active) return; |
|
|
|
|
|
const crystal = generationState.currentCrystal; |
|
|
|
|
|
|
|
|
if (crystal.currentStep >= crystal.maxSteps || crystal.vertices.length >= crystal.targetSize) { |
|
|
completeCurrentCrystal(); |
|
|
startNewCrystal(); |
|
|
return; |
|
|
} |
|
|
|
|
|
crystal.currentStep++; |
|
|
crystal.size = (crystal.currentStep / crystal.maxSteps) * crystal.targetSize; |
|
|
|
|
|
|
|
|
switch(crystal.shape) { |
|
|
case 'quantum_spiral': |
|
|
growQuantumSpiral(); |
|
|
break; |
|
|
case 'fractal_matrix': |
|
|
growFractalMatrix(); |
|
|
break; |
|
|
case 'neural_lattice': |
|
|
growNeuralLattice(); |
|
|
break; |
|
|
case 'temporal_ring': |
|
|
growTemporalRing(); |
|
|
break; |
|
|
} |
|
|
|
|
|
|
|
|
updateCrystalVisualization(); |
|
|
|
|
|
|
|
|
if (autoCaptureEnabled && crystal.currentStep % 10 === 0) { |
|
|
captureImage(); |
|
|
} |
|
|
|
|
|
|
|
|
updateUI(); |
|
|
} |
|
|
|
|
|
|
|
|
function growQuantumSpiral() { |
|
|
const crystal = generationState.currentCrystal; |
|
|
const time = generationState.totalGenerationTime; |
|
|
|
|
|
const layers = Math.max(3, Math.floor(crystal.size / 20)); |
|
|
const currentLayer = Math.floor(crystal.vertices.length / 4); |
|
|
|
|
|
for (let i = 0; i < 3 && crystal.vertices.length < crystal.targetSize; i++) { |
|
|
|
|
|
const timeWarp = Math.sin(time * 0.5 + i * 0.5) * 0.3; |
|
|
const radius = 15 + (currentLayer * 4) + timeWarp * 8; |
|
|
const height = currentLayer * 12; |
|
|
const angle = (currentLayer / layers) * Math.PI * 6 + (i / 3) * Math.PI * 2; |
|
|
|
|
|
const x = Math.cos(angle + time * 0.2) * radius; |
|
|
const y = height + Math.sin(time * 0.3 + i) * 4; |
|
|
const z = Math.sin(angle + time * 0.2) * radius; |
|
|
|
|
|
|
|
|
let nearestIndex = 0; |
|
|
let minDistance = Infinity; |
|
|
|
|
|
for (let j = 0; j < crystal.vertices.length; j++) { |
|
|
const v = crystal.vertices[j]; |
|
|
const dx = x - v.x; |
|
|
const dy = y - v.y; |
|
|
const dz = z - v.z; |
|
|
const distance = Math.sqrt(dx*dx + dy*dy + dz*dz); |
|
|
|
|
|
if (distance < minDistance && distance < 30) { |
|
|
minDistance = distance; |
|
|
nearestIndex = j; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const newVertex = { |
|
|
x: x, |
|
|
y: y, |
|
|
z: z, |
|
|
connections: [nearestIndex], |
|
|
generation: currentLayer, |
|
|
energy: 0.7 + Math.random() * 0.3, |
|
|
color: crystal.color.getHex(), |
|
|
shape: crystal.shape, |
|
|
temporalPhase: null |
|
|
}; |
|
|
|
|
|
crystal.vertices.push(newVertex); |
|
|
|
|
|
|
|
|
if (nearestIndex < crystal.vertices.length) { |
|
|
crystal.vertices[nearestIndex].connections.push(crystal.vertices.length - 1); |
|
|
crystal.edges.push([nearestIndex, crystal.vertices.length - 1]); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
function growFractalMatrix() { |
|
|
const crystal = generationState.currentCrystal; |
|
|
|
|
|
|
|
|
if (crystal.vertices.length === 1) { |
|
|
|
|
|
for (let i = 0; i < 6; i++) { |
|
|
const angle = (i / 6) * Math.PI * 2; |
|
|
const length = 20; |
|
|
|
|
|
crystal.vertices.push({ |
|
|
x: Math.cos(angle) * length, |
|
|
y: Math.sin(angle) * length, |
|
|
z: 0, |
|
|
connections: [0], |
|
|
generation: 1, |
|
|
energy: 0.9, |
|
|
color: crystal.color.getHex(), |
|
|
shape: crystal.shape, |
|
|
temporalPhase: null |
|
|
}); |
|
|
crystal.vertices[0].connections.push(crystal.vertices.length - 1); |
|
|
crystal.edges.push([0, crystal.vertices.length - 1]); |
|
|
} |
|
|
} else { |
|
|
|
|
|
const verticesToBranch = []; |
|
|
|
|
|
|
|
|
for (let i = 0; i < crystal.vertices.length; i++) { |
|
|
const vertex = crystal.vertices[i]; |
|
|
if (vertex.connections.length < 4 && vertex.generation < 5) { |
|
|
verticesToBranch.push(i); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
verticesToBranch.forEach(vertexIndex => { |
|
|
const vertex = crystal.vertices[vertexIndex]; |
|
|
const branches = 1 + Math.floor(Math.random() * 3); |
|
|
|
|
|
for (let b = 0; b < branches && crystal.vertices.length < crystal.targetSize; b++) { |
|
|
|
|
|
const baseAngle = vertex.generation * Math.PI / 2; |
|
|
const branchAngle = baseAngle + (b / branches) * Math.PI * 2; |
|
|
const pitch = Math.random() * Math.PI; |
|
|
|
|
|
|
|
|
const scale = Math.pow(0.6, vertex.generation); |
|
|
const length = 12 + Math.random() * 10; |
|
|
|
|
|
const x = vertex.x + Math.sin(pitch) * Math.cos(branchAngle) * length * scale; |
|
|
const y = vertex.y + Math.cos(pitch) * length * scale; |
|
|
const z = vertex.z + Math.sin(pitch) * Math.sin(branchAngle) * length * scale; |
|
|
|
|
|
const newVertex = { |
|
|
x: x, |
|
|
y: y, |
|
|
z: z, |
|
|
connections: [vertexIndex], |
|
|
generation: vertex.generation + 1, |
|
|
energy: vertex.energy * (0.6 + Math.random() * 0.4), |
|
|
color: crystal.color.getHex(), |
|
|
shape: crystal.shape, |
|
|
temporalPhase: null |
|
|
}; |
|
|
|
|
|
crystal.vertices.push(newVertex); |
|
|
vertex.connections.push(crystal.vertices.length - 1); |
|
|
crystal.edges.push([vertexIndex, crystal.vertices.length - 1]); |
|
|
} |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
function growNeuralLattice() { |
|
|
const crystal = generationState.currentCrystal; |
|
|
const time = generationState.totalGenerationTime; |
|
|
|
|
|
if (crystal.vertices.length < 15) { |
|
|
|
|
|
for (let i = 0; i < 4 && crystal.vertices.length < crystal.targetSize; i++) { |
|
|
const radius = 25 + crystal.size; |
|
|
const theta = Math.random() * Math.PI * 2; |
|
|
const phi = Math.acos(2 * Math.random() - 1); |
|
|
|
|
|
const x = radius * Math.sin(phi) * Math.cos(theta); |
|
|
const y = radius * Math.sin(phi) * Math.sin(theta); |
|
|
const z = radius * Math.cos(phi); |
|
|
|
|
|
const newVertex = { |
|
|
x: x, |
|
|
y: y, |
|
|
z: z, |
|
|
connections: [], |
|
|
generation: Math.floor(crystal.vertices.length / 5), |
|
|
energy: 0.8 + Math.random() * 0.2, |
|
|
color: crystal.color.getHex(), |
|
|
shape: crystal.shape, |
|
|
temporalPhase: null |
|
|
}; |
|
|
|
|
|
|
|
|
const neighbors = []; |
|
|
for (let j = 0; j < crystal.vertices.length; j++) { |
|
|
const v = crystal.vertices[j]; |
|
|
const dx = x - v.x; |
|
|
const dy = y - v.y; |
|
|
const dz = z - v.z; |
|
|
const distance = Math.sqrt(dx*dx + dy*dy + dz*dz); |
|
|
neighbors.push({index: j, distance: distance}); |
|
|
} |
|
|
|
|
|
neighbors.sort((a, b) => a.distance - b.distance); |
|
|
|
|
|
const maxConnections = Math.min(3, neighbors.length); |
|
|
for (let n = 0; n < maxConnections; n++) { |
|
|
if (neighbors[n].distance < 40) { |
|
|
newVertex.connections.push(neighbors[n].index); |
|
|
crystal.vertices[neighbors[n].index].connections.push(crystal.vertices.length); |
|
|
crystal.edges.push([neighbors[n].index, crystal.vertices.length]); |
|
|
} |
|
|
} |
|
|
|
|
|
crystal.vertices.push(newVertex); |
|
|
} |
|
|
} else { |
|
|
|
|
|
|
|
|
const newConnections = Math.min(8, Math.floor(crystal.vertices.length / 20)); |
|
|
|
|
|
for (let c = 0; c < newConnections; c++) { |
|
|
const i = Math.floor(Math.random() * crystal.vertices.length); |
|
|
const j = Math.floor(Math.random() * crystal.vertices.length); |
|
|
|
|
|
if (i !== j && !crystal.vertices[i].connections.includes(j)) { |
|
|
const v1 = crystal.vertices[i]; |
|
|
const v2 = crystal.vertices[j]; |
|
|
const dx = v1.x - v2.x; |
|
|
const dy = v1.y - v2.y; |
|
|
const dz = v1.z - v2.z; |
|
|
const distance = Math.sqrt(dx*dx + dy*dy + dz*dz); |
|
|
|
|
|
|
|
|
const connectionProbability = Math.exp(-distance / 30) * (0.5 + 0.5 * Math.sin(time * 0.5)); |
|
|
|
|
|
if (distance < 50 && Math.random() < connectionProbability) { |
|
|
crystal.vertices[i].connections.push(j); |
|
|
crystal.vertices[j].connections.push(i); |
|
|
crystal.edges.push([i, j]); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (Math.random() > 0.8 && crystal.vertices.length < crystal.targetSize) { |
|
|
const radius = 40 + crystal.size / 2; |
|
|
const theta = Math.random() * Math.PI * 2; |
|
|
const phi = Math.acos(2 * Math.random() - 1); |
|
|
|
|
|
const x = radius * Math.sin(phi) * Math.cos(theta); |
|
|
const y = radius * Math.sin(phi) * Math.sin(theta); |
|
|
const z = radius * Math.cos(phi); |
|
|
|
|
|
const newVertex = { |
|
|
x: x, |
|
|
y: y, |
|
|
z: z, |
|
|
connections: [], |
|
|
generation: Math.floor(crystal.vertices.length / 25), |
|
|
energy: 0.7 + Math.random() * 0.3, |
|
|
color: crystal.color.getHex(), |
|
|
shape: crystal.shape, |
|
|
temporalPhase: null |
|
|
}; |
|
|
|
|
|
crystal.vertices.push(newVertex); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
function growTemporalRing() { |
|
|
const crystal = generationState.currentCrystal; |
|
|
const time = generationState.totalGenerationTime; |
|
|
|
|
|
const segments = Math.min(120, 30 + Math.floor(crystal.size / 2)); |
|
|
const currentSegment = crystal.vertices.length; |
|
|
|
|
|
if (currentSegment >= segments) return; |
|
|
|
|
|
const radius = 30 + crystal.size / 3; |
|
|
const angle = (currentSegment / segments) * Math.PI * 2; |
|
|
|
|
|
|
|
|
const timeDistortion = Math.sin(time * 0.5 + currentSegment * 0.1) * 0.5; |
|
|
const phaseShift = time * 0.3; |
|
|
const verticalWave = Math.sin(angle * 3 + time * 0.4) * 10; |
|
|
|
|
|
const x = Math.cos(angle + phaseShift) * radius * (1 + timeDistortion * 0.2); |
|
|
const z = Math.sin(angle + phaseShift) * radius * (1 + timeDistortion * 0.2); |
|
|
const y = verticalWave; |
|
|
|
|
|
const newVertex = { |
|
|
x: x, |
|
|
y: y, |
|
|
z: z, |
|
|
connections: [], |
|
|
generation: currentSegment, |
|
|
energy: 0.8 + Math.abs(Math.sin(angle)) * 0.2, |
|
|
color: crystal.color.getHex(), |
|
|
shape: crystal.shape, |
|
|
temporalPhase: angle |
|
|
}; |
|
|
|
|
|
|
|
|
if (currentSegment > 0) { |
|
|
newVertex.connections.push(currentSegment - 1); |
|
|
crystal.vertices[currentSegment - 1].connections.push(currentSegment); |
|
|
crystal.edges.push([currentSegment - 1, currentSegment]); |
|
|
} |
|
|
|
|
|
|
|
|
if (currentSegment > segments / 4 && currentSegment % (segments/8) === 0) { |
|
|
const oppositeIndex = Math.floor((currentSegment + segments/2) % segments); |
|
|
if (oppositeIndex < crystal.vertices.length) { |
|
|
newVertex.connections.push(oppositeIndex); |
|
|
crystal.vertices[oppositeIndex].connections.push(currentSegment); |
|
|
crystal.edges.push([oppositeIndex, currentSegment]); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (currentSegment % (segments/12) === 0) { |
|
|
newVertex.connections.push(0); |
|
|
crystal.vertices[0].connections.push(currentSegment); |
|
|
crystal.edges.push([0, currentSegment]); |
|
|
} |
|
|
|
|
|
crystal.vertices.push(newVertex); |
|
|
} |
|
|
|
|
|
function updateCrystalVisualization() { |
|
|
const crystal = generationState.currentCrystal; |
|
|
|
|
|
if (crystal.vertices.length === 0) return; |
|
|
|
|
|
|
|
|
if (!currentCrystal) { |
|
|
const geometry = new THREE.BufferGeometry(); |
|
|
const material = new THREE.LineBasicMaterial({ |
|
|
color: crystal.color, |
|
|
linewidth: 2, |
|
|
transparent: true, |
|
|
opacity: 0.9 |
|
|
}); |
|
|
|
|
|
currentCrystal = new THREE.LineSegments(geometry, material); |
|
|
scene.add(currentCrystal); |
|
|
|
|
|
|
|
|
const pointGeometry = new THREE.BufferGeometry(); |
|
|
const pointMaterial = new THREE.PointsMaterial({ |
|
|
color: crystal.color, |
|
|
size: 3, |
|
|
transparent: true, |
|
|
opacity: 0.7 |
|
|
}); |
|
|
|
|
|
currentCrystal.points = new THREE.Points(pointGeometry, pointMaterial); |
|
|
scene.add(currentCrystal.points); |
|
|
} |
|
|
|
|
|
|
|
|
const positions = new Float32Array(crystal.vertices.length * 3); |
|
|
const indices = []; |
|
|
|
|
|
for (let i = 0; i < crystal.vertices.length; i++) { |
|
|
const v = crystal.vertices[i]; |
|
|
positions[i * 3] = v.x; |
|
|
positions[i * 3 + 1] = v.y; |
|
|
positions[i * 3 + 2] = v.z; |
|
|
} |
|
|
|
|
|
for (const [a, b] of crystal.edges) { |
|
|
indices.push(a, b); |
|
|
} |
|
|
|
|
|
|
|
|
currentCrystal.geometry.dispose(); |
|
|
currentCrystal.geometry = new THREE.BufferGeometry(); |
|
|
currentCrystal.geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3)); |
|
|
currentCrystal.geometry.setIndex(indices); |
|
|
|
|
|
|
|
|
currentCrystal.points.geometry.dispose(); |
|
|
currentCrystal.points.geometry = new THREE.BufferGeometry(); |
|
|
currentCrystal.points.geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3)); |
|
|
|
|
|
|
|
|
const pulse = 0.8 + 0.2 * Math.sin(generationState.totalGenerationTime * 2); |
|
|
currentCrystal.material.opacity = pulse * 0.9; |
|
|
currentCrystal.material.color = crystal.color; |
|
|
currentCrystal.points.material.color = crystal.color; |
|
|
currentCrystal.points.material.opacity = pulse * 0.7; |
|
|
|
|
|
|
|
|
currentCrystal.rotation.y += 0.001 * generationState.timeScale; |
|
|
currentCrystal.points.rotation.y = currentCrystal.rotation.y; |
|
|
} |
|
|
|
|
|
function completeCurrentCrystal() { |
|
|
const crystal = generationState.currentCrystal; |
|
|
|
|
|
|
|
|
captureImage(); |
|
|
|
|
|
|
|
|
const normalizedVertices = crystal.vertices.map(v => ({ |
|
|
...v, |
|
|
temporalPhase: v.temporalPhase !== undefined ? v.temporalPhase : null |
|
|
})); |
|
|
|
|
|
|
|
|
const crystalData = { |
|
|
id: generationState.crystalCount, |
|
|
shape: crystal.shape, |
|
|
vertices: crystal.vertices.length, |
|
|
edges: crystal.edges.length, |
|
|
size: crystal.size, |
|
|
generationSteps: crystal.currentStep, |
|
|
generationTime: crystal.currentStep * 0.05, |
|
|
color: crystal.color.getHex(), |
|
|
vertexData: normalizedVertices, |
|
|
edgeData: crystal.edges, |
|
|
images: dataset.capturedImages.filter(img => img.metadata.crystalId === generationState.crystalCount) |
|
|
}; |
|
|
|
|
|
dataset.crystals.push(crystalData); |
|
|
generationState.crystalCount++; |
|
|
|
|
|
console.log(`TIMELINK: Completed crystal #${generationState.crystalCount} with ${crystal.vertices.length} vertices`); |
|
|
} |
|
|
|
|
|
function startNewCrystal() { |
|
|
if (!generationState.active) return; |
|
|
|
|
|
|
|
|
initializeCrystal(); |
|
|
} |
|
|
|
|
|
|
|
|
function captureImage() { |
|
|
try { |
|
|
const canvas = document.getElementById('threeCanvas'); |
|
|
|
|
|
|
|
|
if (!canvas || canvas.width === 0) { |
|
|
console.warn("Canvas not ready for capture"); |
|
|
return; |
|
|
} |
|
|
|
|
|
|
|
|
const imageData = canvas.toDataURL('image/png', 1.0); |
|
|
|
|
|
|
|
|
const imageMetadata = { |
|
|
timestamp: Date.now(), |
|
|
crystalId: generationState.crystalCount, |
|
|
crystalShape: generationState.currentShape, |
|
|
step: generationState.currentCrystal.currentStep, |
|
|
vertices: generationState.currentCrystal.vertices.length, |
|
|
edges: generationState.currentCrystal.edges.length, |
|
|
size: generationState.currentCrystal.size, |
|
|
timeScale: generationState.timeScale, |
|
|
generationTime: generationState.totalGenerationTime |
|
|
}; |
|
|
|
|
|
|
|
|
dataset.capturedImages.push({ |
|
|
data: imageData, |
|
|
metadata: imageMetadata, |
|
|
type: 'manual' |
|
|
}); |
|
|
|
|
|
dataset.totalImages++; |
|
|
dataset.manualCaptureCount++; |
|
|
|
|
|
|
|
|
document.getElementById('imageCount').textContent = dataset.totalImages; |
|
|
document.getElementById('captureCount').textContent = dataset.totalImages; |
|
|
|
|
|
const captureProgress = Math.min((dataset.totalImages / 100) * 100, 100); |
|
|
document.getElementById('captureProgress').style.width = captureProgress + '%'; |
|
|
|
|
|
|
|
|
if (dataset.totalImages % 5 === 0) { |
|
|
showNotification("IMAGE CAPTURED", `Saved image #${dataset.totalImages} for dataset`); |
|
|
} |
|
|
|
|
|
} catch (error) { |
|
|
console.error("TIMELINK: Image capture error:", error); |
|
|
} |
|
|
} |
|
|
|
|
|
function toggleAutoCapture() { |
|
|
autoCaptureEnabled = !autoCaptureEnabled; |
|
|
const btn = document.getElementById('autoCaptureBtn'); |
|
|
|
|
|
if (autoCaptureEnabled) { |
|
|
btn.textContent = '⚙ AUTO: ON'; |
|
|
btn.classList.add('ready'); |
|
|
showNotification("AUTO CAPTURE", "Auto-capture enabled (every 10 steps)"); |
|
|
} else { |
|
|
btn.textContent = '⚙ AUTO: OFF'; |
|
|
btn.classList.remove('ready'); |
|
|
showNotification("AUTO CAPTURE", "Auto-capture disabled"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function exportCurrentCrystal() { |
|
|
if (generationState.currentCrystal.vertices.length === 0) { |
|
|
showNotification("ERROR", "No crystal data to export"); |
|
|
return; |
|
|
} |
|
|
|
|
|
showNotification("EXPORTING", "Exporting current crystal dataset..."); |
|
|
|
|
|
try { |
|
|
const zip = new JSZip(); |
|
|
const timestamp = new Date().toISOString().replace(/[:.]/g, '-'); |
|
|
const crystalId = generationState.crystalCount; |
|
|
const shapeName = formatShapeName(generationState.currentShape).toLowerCase().replace(' ', '_'); |
|
|
|
|
|
|
|
|
const metadata = { |
|
|
crystal_id: crystalId, |
|
|
shape: generationState.currentShape, |
|
|
shape_name: formatShapeName(generationState.currentShape), |
|
|
vertices: generationState.currentCrystal.vertices.length, |
|
|
edges: generationState.currentCrystal.edges.length, |
|
|
generation_time: generationState.totalGenerationTime, |
|
|
export_time: new Date().toISOString(), |
|
|
time_scale: generationState.timeScale, |
|
|
images_captured: dataset.capturedImages.filter(img => img.metadata.crystalId === crystalId).length |
|
|
}; |
|
|
|
|
|
zip.file("metadata.json", JSON.stringify(metadata, null, 2)); |
|
|
|
|
|
|
|
|
const crystalData = { |
|
|
vertices: generationState.currentCrystal.vertices, |
|
|
edges: generationState.currentCrystal.edges, |
|
|
parameters: { |
|
|
target_size: generationState.currentCrystal.targetSize, |
|
|
color: generationState.currentCrystal.color.getHex(), |
|
|
time_scale: generationState.timeScale |
|
|
} |
|
|
}; |
|
|
|
|
|
zip.file("crystal_data.json", JSON.stringify(crystalData, null, 2)); |
|
|
|
|
|
|
|
|
const imgFolder = zip.folder("images"); |
|
|
const crystalImages = dataset.capturedImages.filter(img => img.metadata.crystalId === crystalId); |
|
|
|
|
|
crystalImages.forEach((image, index) => { |
|
|
const base64Data = image.data.replace(/^data:image\/png;base64,/, ""); |
|
|
imgFolder.file(`step_${index.toString().padStart(4, '0')}.png`, base64Data, {base64: true}); |
|
|
}); |
|
|
|
|
|
|
|
|
const readme = generateCrystalReadme(metadata, crystalImages.length); |
|
|
zip.file("README.md", readme); |
|
|
|
|
|
|
|
|
const content = await zip.generateAsync({type: "blob"}); |
|
|
const filename = `timelink_${shapeName}_crystal_${timestamp}.zip`; |
|
|
|
|
|
saveAs(content, filename); |
|
|
|
|
|
showNotification("SUCCESS", `Exported ${shapeName} crystal dataset`); |
|
|
|
|
|
} catch (error) { |
|
|
console.error("TIMELINK: Export error:", error); |
|
|
showNotification("ERROR", `Export failed: ${error.message}`); |
|
|
} |
|
|
} |
|
|
|
|
|
async function exportCompleteDataset() { |
|
|
if (dataset.crystals.length === 0 && generationState.currentCrystal.vertices.length === 0) { |
|
|
showNotification("ERROR", "No dataset to export"); |
|
|
return; |
|
|
} |
|
|
|
|
|
showNotification("EXPORTING", "Preparing complete dataset package..."); |
|
|
|
|
|
try { |
|
|
const zip = new JSZip(); |
|
|
const timestamp = new Date().toISOString().replace(/[:.]/g, '-'); |
|
|
|
|
|
|
|
|
const datasetRows = []; |
|
|
|
|
|
dataset.crystals.forEach((crystal, index) => { |
|
|
|
|
|
const normalizedVertexData = crystal.vertexData.map(vertex => ({ |
|
|
...vertex, |
|
|
temporalPhase: vertex.temporalPhase !== undefined ? vertex.temporalPhase : null |
|
|
})); |
|
|
|
|
|
|
|
|
const row = { |
|
|
id: crystal.id, |
|
|
shape: crystal.shape, |
|
|
vertices: crystal.vertices, |
|
|
edges: crystal.edges, |
|
|
size: crystal.size, |
|
|
generationSteps: crystal.generationSteps, |
|
|
generationTime: parseFloat(crystal.generationTime), |
|
|
color: crystal.color, |
|
|
vertexData: normalizedVertexData, |
|
|
edgeData: crystal.edgeData, |
|
|
|
|
|
images_count: crystal.images ? crystal.images.length : 0 |
|
|
}; |
|
|
|
|
|
datasetRows.push(row); |
|
|
|
|
|
|
|
|
const crystalFolder = zip.folder(`crystal_${crystal.id}_${crystal.shape}`); |
|
|
|
|
|
|
|
|
crystalFolder.file("metadata.json", JSON.stringify({ |
|
|
id: crystal.id, |
|
|
shape: crystal.shape, |
|
|
vertices: crystal.vertices, |
|
|
edges: crystal.edges, |
|
|
generationTime: parseFloat(crystal.generationTime), |
|
|
export_time: new Date().toISOString() |
|
|
}, null, 2)); |
|
|
|
|
|
|
|
|
if (crystal.images && crystal.images.length > 0) { |
|
|
const imgFolder = crystalFolder.folder("images"); |
|
|
crystal.images.forEach((image, imgIndex) => { |
|
|
const base64Data = image.data.replace(/^data:image\/png;base64,/, ""); |
|
|
imgFolder.file(`step_${imgIndex.toString().padStart(4, '0')}.png`, base64Data, {base64: true}); |
|
|
}); |
|
|
} |
|
|
}); |
|
|
|
|
|
|
|
|
const metadata = { |
|
|
total_crystals: dataset.crystals.length, |
|
|
total_images: dataset.totalImages, |
|
|
total_generation_time: generationState.totalGenerationTime, |
|
|
start_time: new Date(generationState.startTime).toISOString(), |
|
|
export_time: new Date().toISOString(), |
|
|
shapes_generated: [...new Set(dataset.crystals.map(c => c.shape))], |
|
|
system_info: { |
|
|
memory_usage: `${systemMonitor.memoryUsage} MB`, |
|
|
performance_level: systemMonitor.performanceLevel |
|
|
}, |
|
|
|
|
|
data_format: "row-oriented JSON (list of objects)", |
|
|
features: { |
|
|
id: "int64 - Crystal ID", |
|
|
shape: "string - Crystal shape type", |
|
|
vertices: "int64 - Number of vertices", |
|
|
edges: "int64 - Number of edges", |
|
|
size: "float64 - Crystal size metric", |
|
|
generationSteps: "int64 - Steps to generate", |
|
|
generationTime: "float64 - Time to generate (seconds)", |
|
|
color: "int64 - Hex color code", |
|
|
vertexData: "list of structs - Vertex information", |
|
|
edgeData: "list of lists - Edge connections", |
|
|
images_count: "int64 - Number of images captured" |
|
|
} |
|
|
}; |
|
|
|
|
|
|
|
|
zip.file("dataset.json", JSON.stringify(datasetRows, null, 2)); |
|
|
zip.file("dataset_metadata.json", JSON.stringify(metadata, null, 2)); |
|
|
|
|
|
|
|
|
const summary = generateDatasetSummary(metadata); |
|
|
zip.file("summary.txt", summary); |
|
|
|
|
|
const readme = generateCompleteReadme(metadata); |
|
|
zip.file("README.md", readme); |
|
|
|
|
|
|
|
|
const content = await zip.generateAsync({type: "blob"}); |
|
|
const filename = `timelink_complete_dataset_${timestamp}.zip`; |
|
|
|
|
|
saveAs(content, filename); |
|
|
|
|
|
showNotification("SUCCESS", `Exported complete dataset (${metadata.total_crystals} crystals, ${metadata.total_images} images)`); |
|
|
|
|
|
} catch (error) { |
|
|
console.error("TIMELINK: Export error:", error); |
|
|
showNotification("ERROR", `Export failed: ${error.message}`); |
|
|
} |
|
|
} |
|
|
|
|
|
async function exportHuggingFace() { |
|
|
if (dataset.crystals.length === 0) { |
|
|
showNotification("ERROR", "No dataset to export for Hugging Face"); |
|
|
return; |
|
|
} |
|
|
|
|
|
showNotification("EXPORTING", "Preparing Hugging Face dataset..."); |
|
|
|
|
|
try { |
|
|
const zip = new JSZip(); |
|
|
const timestamp = new Date().toISOString().replace(/[:.]/g, '-'); |
|
|
|
|
|
|
|
|
const hfData = dataset.crystals.map(crystal => { |
|
|
|
|
|
const normalizedVertexData = crystal.vertexData.map(vertex => { |
|
|
|
|
|
const normalizedVertex = { ...vertex }; |
|
|
|
|
|
|
|
|
if (!('temporalPhase' in normalizedVertex)) { |
|
|
normalizedVertex.temporalPhase = null; |
|
|
} |
|
|
|
|
|
|
|
|
return { |
|
|
x: parseFloat(normalizedVertex.x) || 0.0, |
|
|
y: parseFloat(normalizedVertex.y) || 0.0, |
|
|
z: parseFloat(normalizedVertex.z) || 0.0, |
|
|
connections: normalizedVertex.connections || [], |
|
|
generation: parseInt(normalizedVertex.generation) || 0, |
|
|
energy: parseFloat(normalizedVertex.energy) || 0.0, |
|
|
color: parseInt(normalizedVertex.color) || 0x00ff00, |
|
|
shape: normalizedVertex.shape || crystal.shape, |
|
|
temporalPhase: normalizedVertex.temporalPhase !== null ? |
|
|
parseFloat(normalizedVertex.temporalPhase) : null |
|
|
}; |
|
|
}); |
|
|
|
|
|
|
|
|
const normalizedEdgeData = crystal.edgeData.map(edge => { |
|
|
if (Array.isArray(edge) && edge.length === 2) { |
|
|
return [parseInt(edge[0]) || 0, parseInt(edge[1]) || 0]; |
|
|
} else { |
|
|
return [0, 0]; |
|
|
} |
|
|
}); |
|
|
|
|
|
|
|
|
return { |
|
|
id: crystal.id, |
|
|
shape: crystal.shape, |
|
|
vertices: parseInt(crystal.vertices) || 0, |
|
|
edges: parseInt(crystal.edges) || 0, |
|
|
size: parseFloat(crystal.size) || 0.0, |
|
|
generationSteps: parseInt(crystal.generationSteps) || 0, |
|
|
generationTime: parseFloat(crystal.generationTime) || 0.0, |
|
|
color: parseInt(crystal.color) || 0x00ff00, |
|
|
vertexData: normalizedVertexData, |
|
|
edgeData: normalizedEdgeData |
|
|
|
|
|
}; |
|
|
}); |
|
|
|
|
|
|
|
|
const hfMetadata = { |
|
|
"description": `TIMELINK Time Crystal Dataset - ${dataset.crystals.length} crystals`, |
|
|
"citation": "@misc{timelink2025,\n title={TIMELINK: Quantum Time Crystal Generation},\n author={WebXOS Research},\n year={2025},\n note={Dataset of algorithmically generated time crystal structures}\n}", |
|
|
"license": "mit", |
|
|
"language": "en", |
|
|
"size_categories": ["n<1K", "1K<n<10K"], |
|
|
"task_categories": ["graph-generation", "image-generation"], |
|
|
"task_ids": ["graph-generation", "image-generation", "time-series-generation"], |
|
|
"pretty_name": "TIMELINK Time Crystal Dataset", |
|
|
"tags": ["quantum", "crystal", "graph", "3d", "generation", "time-series"], |
|
|
"dataset_info": { |
|
|
"features": { |
|
|
"id": {"dtype": "int64", "nullable": false}, |
|
|
"shape": {"dtype": "string", "nullable": false}, |
|
|
"vertices": {"dtype": "int64", "nullable": false}, |
|
|
"edges": {"dtype": "int64", "nullable": false}, |
|
|
"size": {"dtype": "float64", "nullable": false}, |
|
|
"generationSteps": {"dtype": "int64", "nullable": false}, |
|
|
"generationTime": {"dtype": "float64", "nullable": false}, |
|
|
"color": {"dtype": "int64", "nullable": false}, |
|
|
"vertexData": { |
|
|
"feature": { |
|
|
"x": {"dtype": "float64", "nullable": false}, |
|
|
"y": {"dtype": "float64", "nullable": false}, |
|
|
"z": {"dtype": "float64", "nullable": false}, |
|
|
"connections": {"dtype": "int64", "list": true, "nullable": false}, |
|
|
"generation": {"dtype": "int64", "nullable": false}, |
|
|
"energy": {"dtype": "float64", "nullable": false}, |
|
|
"color": {"dtype": "int64", "nullable": false}, |
|
|
"shape": {"dtype": "string", "nullable": false}, |
|
|
"temporalPhase": {"dtype": "float64", "nullable": true} |
|
|
}, |
|
|
"list": true, |
|
|
"nullable": false |
|
|
}, |
|
|
"edgeData": { |
|
|
"feature": { |
|
|
"dtype": "int64", |
|
|
"list": true, |
|
|
"nullable": false |
|
|
}, |
|
|
"list": true, |
|
|
"nullable": false |
|
|
} |
|
|
}, |
|
|
"splits": { |
|
|
"train": { |
|
|
"name": "train", |
|
|
"num_bytes": Math.round(systemMonitor.memoryUsage * 1024 * 1024), |
|
|
"num_examples": dataset.crystals.length |
|
|
} |
|
|
} |
|
|
} |
|
|
}; |
|
|
|
|
|
zip.file("dataset_info.json", JSON.stringify(hfMetadata, null, 2)); |
|
|
zip.file("data.json", JSON.stringify(hfData, null, 2)); |
|
|
|
|
|
|
|
|
dataset.crystals.forEach((crystal, index) => { |
|
|
const crystalImages = dataset.capturedImages.filter(img => img.metadata.crystalId === crystal.id); |
|
|
if (crystalImages.length > 0) { |
|
|
const imgFolder = zip.folder(`images/crystal_${crystal.id}`); |
|
|
crystalImages.forEach((image, imgIndex) => { |
|
|
const base64Data = image.data.replace(/^data:image\/png;base64,/, ""); |
|
|
imgFolder.file(`${crystal.shape}_${imgIndex}.png`, base64Data, {base64: true}); |
|
|
}); |
|
|
} |
|
|
}); |
|
|
|
|
|
|
|
|
const datasetCard = generateHuggingFaceDatasetCard(hfMetadata, dataset.crystals.length); |
|
|
zip.file("README.md", datasetCard); |
|
|
|
|
|
|
|
|
const datasetInfos = { |
|
|
"default": hfMetadata |
|
|
}; |
|
|
zip.file("dataset_infos.json", JSON.stringify(datasetInfos, null, 2)); |
|
|
|
|
|
|
|
|
const content = await zip.generateAsync({type: "blob"}); |
|
|
const filename = `timelink_huggingface_dataset_${timestamp}.zip`; |
|
|
|
|
|
saveAs(content, filename); |
|
|
|
|
|
showNotification("SUCCESS", "Hugging Face dataset exported! Upload data.json and images folder to HF"); |
|
|
|
|
|
} catch (error) { |
|
|
console.error("TIMELINK: Export error:", error); |
|
|
showNotification("ERROR", `Export failed: ${error.message}`); |
|
|
} |
|
|
} |
|
|
|
|
|
function generateCrystalReadme(metadata, imageCount) { |
|
|
return `# TIMELINK Crystal Dataset |
|
|
|
|
|
## Crystal Information |
|
|
- **ID**: ${metadata.crystal_id} |
|
|
- **Shape**: ${metadata.shape_name} |
|
|
- **Vertices**: ${metadata.vertices} |
|
|
- **Edges**: ${metadata.edges} |
|
|
- **Generation Time**: ${metadata.generation_time.toFixed(2)} seconds |
|
|
- **Images Captured**: ${imageCount} |
|
|
- **Export Time**: ${metadata.export_time} |
|
|
|
|
|
## Contents |
|
|
- \`metadata.json\` - Crystal metadata |
|
|
- \`crystal_data.json\` - Complete crystal structure data |
|
|
- \`images/\` - Captured PNG images of growth steps |
|
|
- \`README.md\` - This file |
|
|
|
|
|
## Usage |
|
|
This dataset can be used for: |
|
|
1. Graph neural network training |
|
|
2. 3D structure analysis |
|
|
3. Time series generation studies |
|
|
4. Quantum crystal simulation |
|
|
|
|
|
## License |
|
|
MIT License - Free for academic and research use. |
|
|
`; |
|
|
} |
|
|
|
|
|
function generateCompleteReadme(metadata) { |
|
|
return `# TIMELINK Complete Dataset |
|
|
|
|
|
## Dataset Overview |
|
|
Total Crystals: ${metadata.total_crystals} |
|
|
Total Images: ${metadata.total_images} |
|
|
Generation Time: ${metadata.total_generation_time.toFixed(2)} seconds |
|
|
Shapes Generated: ${metadata.shapes_generated.join(', ')} |
|
|
|
|
|
## File Structure |
|
|
\`\`\` |
|
|
dataset.zip/ |
|
|
├── dataset.json # Main dataset file (row-oriented) |
|
|
├── dataset_metadata.json # Complete dataset metadata |
|
|
├── summary.txt # Statistical summary |
|
|
├── README.md # This file |
|
|
└── crystal_*/ # Individual crystal folders |
|
|
├── images/ # Crystal growth images |
|
|
└── metadata.json # Crystal-specific metadata |
|
|
\`\`\` |
|
|
|
|
|
## Data Format |
|
|
Each crystal in dataset.json includes: |
|
|
- 3D vertex positions (x, y, z) |
|
|
- Edge connections between vertices |
|
|
- Growth time series data |
|
|
- Comprehensive metadata |
|
|
|
|
|
Note: Images are stored separately in crystal folders to avoid large JSON files. |
|
|
|
|
|
## Applications |
|
|
- Machine learning training data |
|
|
- 3D graph generation research |
|
|
- Quantum system simulation |
|
|
- Time series analysis |
|
|
- Computer graphics research |
|
|
|
|
|
## Citation |
|
|
@misc{timelink2025, |
|
|
title={TIMELINK: Hybrid Time Scaling Crystal Generator}, |
|
|
author={WebXOS Research}, |
|
|
year={2025}, |
|
|
note={Complete time crystal growth dataset} |
|
|
} |
|
|
|
|
|
## License |
|
|
MIT License |
|
|
`; |
|
|
} |
|
|
|
|
|
function generateHuggingFaceDatasetCard(metadata, crystalCount) { |
|
|
return `# TIMELINK Time Crystal Dataset |
|
|
|
|
|
## Dataset Description |
|
|
This dataset contains ${crystalCount} algorithmically generated time crystal structures with corresponding growth images. |
|
|
|
|
|
### Dataset Summary |
|
|
Time crystals are quantum systems that exhibit periodic motion in their ground state. This dataset captures complete growth trajectories of algorithmically generated time crystals. |
|
|
|
|
|
### Supported Tasks |
|
|
- Graph generation and completion |
|
|
- Image generation from 3D structures |
|
|
- Time series forecasting |
|
|
- 3D structure prediction |
|
|
|
|
|
### Languages |
|
|
English |
|
|
|
|
|
## Dataset Structure |
|
|
### Data Instances |
|
|
Each instance represents a complete time crystal with: |
|
|
- 3D vertex positions in vertexData |
|
|
- Edge connections in edgeData |
|
|
- Growth images in the images folder |
|
|
- Metadata including generation parameters |
|
|
|
|
|
### Data Fields |
|
|
- \`id\`: Unique crystal identifier |
|
|
- \`shape\`: Crystal shape type (quantum_spiral, fractal_matrix, neural_lattice, temporal_ring) |
|
|
- \`vertices\`: Number of vertices |
|
|
- \`edges\`: Number of edges |
|
|
- \`size\`: Crystal size metric |
|
|
- \`generationSteps\`: Steps taken to generate the crystal |
|
|
- \`generationTime\`: Time taken to generate (seconds) |
|
|
- \`color\`: Hex color code |
|
|
- \`vertexData\`: List of vertex objects with x, y, z coordinates and properties |
|
|
- \`edgeData\`: List of edge connections between vertices |
|
|
|
|
|
## Usage |
|
|
\`\`\`python |
|
|
from datasets import load_dataset |
|
|
|
|
|
# Load the dataset |
|
|
dataset = load_dataset("json", data_files="data.json") |
|
|
|
|
|
# Access the first crystal |
|
|
first_crystal = dataset['train'][0] |
|
|
print(f"Crystal ID: {first_crystal['id']}") |
|
|
print(f"Shape: {first_crystal['shape']}") |
|
|
print(f"Vertices: {first_crystal['vertices']}") |
|
|
\`\`\` |
|
|
|
|
|
## Citation |
|
|
${metadata.citation} |
|
|
|
|
|
## License |
|
|
${metadata.license.toUpperCase()} License |
|
|
|
|
|
## Dataset Creation |
|
|
This dataset was generated using TIMELINK v1.0 - Central Control Crystal Generator. |
|
|
`; |
|
|
} |
|
|
|
|
|
function generateDatasetSummary(metadata) { |
|
|
return `TIMELINK DATASET SUMMARY |
|
|
============================ |
|
|
Total Crystals: ${metadata.total_crystals} |
|
|
Total Images: ${metadata.total_images} |
|
|
Total Generation Time: ${metadata.total_generation_time.toFixed(2)} seconds |
|
|
Shapes Generated: ${metadata.shapes_generated.join(', ')} |
|
|
Export Time: ${metadata.export_time} |
|
|
Memory Usage: ${metadata.system_info.memory_usage} |
|
|
Performance Level: ${metadata.system_info.performance_level} |
|
|
`; |
|
|
} |
|
|
|
|
|
|
|
|
function updateUI() { |
|
|
|
|
|
document.getElementById('crystalCount').textContent = generationState.crystalCount; |
|
|
|
|
|
|
|
|
updateCrystalInfo(); |
|
|
|
|
|
|
|
|
const crystalProgress = (generationState.currentCrystal.currentStep / generationState.currentCrystal.maxSteps) * 100; |
|
|
updateCrystalProgress(crystalProgress); |
|
|
|
|
|
|
|
|
updateTimeDisplay(); |
|
|
|
|
|
|
|
|
updateDatasetSize(); |
|
|
} |
|
|
|
|
|
function updateCrystalInfo() { |
|
|
const crystal = generationState.currentCrystal; |
|
|
document.getElementById('currentCrystalInfo').textContent = |
|
|
`${formatShapeName(crystal.shape)} #${generationState.crystalCount + 1}`; |
|
|
document.getElementById('vertexCount').textContent = |
|
|
`${crystal.vertices.length} vertices / ${crystal.edges.length} edges`; |
|
|
} |
|
|
|
|
|
function updateCrystalProgress(percent) { |
|
|
document.getElementById('crystalProgress').style.width = percent + '%'; |
|
|
document.getElementById('crystalProgressText').textContent = Math.round(percent) + '%'; |
|
|
} |
|
|
|
|
|
function updateTimeDisplay() { |
|
|
generationState.totalGenerationTime = (Date.now() - generationState.startTime) / 1000; |
|
|
|
|
|
const totalSeconds = Math.floor(generationState.totalGenerationTime); |
|
|
const hours = Math.floor(totalSeconds / 3600); |
|
|
const minutes = Math.floor((totalSeconds % 3600) / 60); |
|
|
const seconds = totalSeconds % 60; |
|
|
|
|
|
const timeString = `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`; |
|
|
document.getElementById('timeDisplay').textContent = timeString; |
|
|
document.getElementById('totalTime').textContent = totalSeconds + 's'; |
|
|
} |
|
|
|
|
|
function updateDatasetSize() { |
|
|
|
|
|
const dataSize = JSON.stringify(dataset.crystals).length / (1024 * 1024); |
|
|
const imageSize = dataset.totalImages * 0.5; |
|
|
systemMonitor.memoryUsage = Math.round(dataSize + imageSize); |
|
|
|
|
|
document.getElementById('datasetSize').textContent = `${systemMonitor.memoryUsage} MB`; |
|
|
|
|
|
const datasetProgress = Math.min((systemMonitor.memoryUsage / 500) * 100, 100); |
|
|
document.getElementById('datasetProgress').style.width = datasetProgress + '%'; |
|
|
|
|
|
|
|
|
document.getElementById('exportReady').textContent = |
|
|
dataset.crystals.length > 0 ? 'YES' : 'NO'; |
|
|
} |
|
|
|
|
|
function updateShapeButtons() { |
|
|
document.querySelectorAll('.shape-btn').forEach(btn => { |
|
|
btn.classList.remove('active'); |
|
|
if (btn.textContent.includes(formatShapeName(generationState.currentShape).toUpperCase())) { |
|
|
btn.classList.add('active'); |
|
|
} |
|
|
}); |
|
|
} |
|
|
|
|
|
function toggleFullscreen() { |
|
|
const elem = document.documentElement; |
|
|
|
|
|
if (!document.fullscreenElement) { |
|
|
if (elem.requestFullscreen) elem.requestFullscreen(); |
|
|
else if (elem.webkitRequestFullscreen) elem.webkitRequestFullscreen(); |
|
|
else if (elem.msRequestFullscreen) elem.msRequestFullscreen(); |
|
|
|
|
|
document.getElementById('fullscreen-btn').textContent = '🗗 EXIT FULLSCREEN'; |
|
|
isFullscreen = true; |
|
|
} else { |
|
|
if (document.exitFullscreen) document.exitFullscreen(); |
|
|
else if (document.webkitExitFullscreen) document.webkitExitFullscreen(); |
|
|
else if (document.msExitFullscreen) document.msExitFullscreen(); |
|
|
|
|
|
document.getElementById('fullscreen-btn').textContent = '⛶ FULLSCREEN'; |
|
|
isFullscreen = false; |
|
|
} |
|
|
} |
|
|
|
|
|
function emergencyStop() { |
|
|
console.log("TIMELINK: Emergency stop activated"); |
|
|
|
|
|
generationState.active = false; |
|
|
if (generationInterval) { |
|
|
clearInterval(generationInterval); |
|
|
generationInterval = null; |
|
|
} |
|
|
|
|
|
const centralBtn = document.getElementById('central-generate-btn'); |
|
|
centralBtn.textContent = '⚡ GENERATE CRYSTALS'; |
|
|
centralBtn.classList.remove('generating', 'paused'); |
|
|
centralBtn.classList.add('float'); |
|
|
centralBtn.style.animation = 'float 3s ease-in-out infinite'; |
|
|
|
|
|
if (generationState.currentCrystal.vertices.length > 0) { |
|
|
exportCompleteDataset(); |
|
|
} |
|
|
|
|
|
showNotification("EMERGENCY STOP", "Generation stopped. Dataset exported."); |
|
|
} |
|
|
|
|
|
function continueGeneration() { |
|
|
hideSystemWarning(); |
|
|
systemMonitor.warningShown = false; |
|
|
} |
|
|
|
|
|
function showSystemWarning() { |
|
|
document.getElementById('system-warning').style.display = 'block'; |
|
|
} |
|
|
|
|
|
function hideSystemWarning() { |
|
|
document.getElementById('system-warning').style.display = 'none'; |
|
|
} |
|
|
|
|
|
function showNotification(title, message) { |
|
|
const notification = document.getElementById('notification'); |
|
|
document.getElementById('notificationTitle').textContent = title; |
|
|
document.getElementById('notificationMessage').textContent = message; |
|
|
notification.style.display = 'block'; |
|
|
|
|
|
setTimeout(() => { |
|
|
notification.style.display = 'none'; |
|
|
}, 3000); |
|
|
} |
|
|
|
|
|
|
|
|
function animate(currentTime) { |
|
|
animationId = requestAnimationFrame(animate); |
|
|
|
|
|
|
|
|
if (!systemMonitor.lastFrameTime) { |
|
|
systemMonitor.lastFrameTime = currentTime; |
|
|
systemMonitor.frameCount = 0; |
|
|
} |
|
|
|
|
|
systemMonitor.frameCount++; |
|
|
const deltaTime = currentTime - systemMonitor.lastFrameTime; |
|
|
|
|
|
if (deltaTime >= 1000) { |
|
|
systemMonitor.fps = Math.round((systemMonitor.frameCount * 1000) / deltaTime); |
|
|
document.getElementById('fpsCounter').textContent = systemMonitor.fps; |
|
|
systemMonitor.frameCount = 0; |
|
|
systemMonitor.lastFrameTime = currentTime; |
|
|
} |
|
|
|
|
|
|
|
|
if (window.particleLayers) { |
|
|
window.particleLayers.forEach((particles, index) => { |
|
|
const positions = particles.geometry.attributes.position.array; |
|
|
for (let i = 0; i < positions.length; i += 3) { |
|
|
const speed = 0.05 * (index + 1); |
|
|
positions[i] += (Math.random() - 0.5) * speed; |
|
|
positions[i + 1] += (Math.random() - 0.5) * speed; |
|
|
positions[i + 2] += (Math.random() - 0.5) * speed; |
|
|
} |
|
|
particles.geometry.attributes.position.needsUpdate = true; |
|
|
}); |
|
|
} |
|
|
|
|
|
|
|
|
if (currentCrystal && generationState.active) { |
|
|
currentCrystal.rotation.y += 0.002 * generationState.timeScale; |
|
|
if (currentCrystal.points) { |
|
|
currentCrystal.points.rotation.y = currentCrystal.rotation.y; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (controls) { |
|
|
controls.update(); |
|
|
} |
|
|
|
|
|
|
|
|
if (renderer && scene && camera) { |
|
|
renderer.render(scene, camera); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function init() { |
|
|
console.log("TIMELINK v1.0 - Central Control Generator - Initializing..."); |
|
|
|
|
|
if (initThreeJS()) { |
|
|
|
|
|
document.getElementById('timeScale').addEventListener('input', function() { |
|
|
generationState.timeScale = parseFloat(this.value); |
|
|
document.getElementById('timeScaleValue').textContent = this.value + 'x'; |
|
|
}); |
|
|
|
|
|
document.addEventListener('fullscreenchange', updateFullscreenButton); |
|
|
document.addEventListener('webkitfullscreenchange', updateFullscreenButton); |
|
|
document.addEventListener('msfullscreenchange', updateFullscreenButton); |
|
|
|
|
|
window.addEventListener('resize', onWindowResize); |
|
|
|
|
|
|
|
|
animate(0); |
|
|
|
|
|
console.log("TIMELINK: System ready with central generate button"); |
|
|
showNotification("SYSTEM READY", "Click the central GENERATE CRYSTALS button to start"); |
|
|
} |
|
|
} |
|
|
|
|
|
function updateFullscreenButton() { |
|
|
const btn = document.getElementById('fullscreen-btn'); |
|
|
if (document.fullscreenElement || document.webkitFullscreenElement || document.msFullscreenElement) { |
|
|
btn.textContent = '🗗 EXIT FULLSCREEN'; |
|
|
isFullscreen = true; |
|
|
} else { |
|
|
btn.textContent = '⛶ FULLSCREEN'; |
|
|
isFullscreen = false; |
|
|
} |
|
|
} |
|
|
|
|
|
function onWindowResize() { |
|
|
if (camera && renderer) { |
|
|
const width = window.innerWidth; |
|
|
const height = window.innerHeight; |
|
|
|
|
|
camera.aspect = width / height; |
|
|
camera.updateProjectionMatrix(); |
|
|
renderer.setSize(width, height); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
window.addEventListener('beforeunload', (e) => { |
|
|
if (generationState.active) { |
|
|
e.preventDefault(); |
|
|
e.returnValue = 'Crystal generation in progress. Are you sure you want to leave?'; |
|
|
emergencyStop(); |
|
|
} |
|
|
}); |
|
|
|
|
|
|
|
|
window.addEventListener('load', init); |
|
|
|
|
|
|
|
|
window.toggleAutomatedGeneration = toggleAutomatedGeneration; |
|
|
window.selectShape = selectShape; |
|
|
window.captureImage = captureImage; |
|
|
window.toggleAutoCapture = toggleAutoCapture; |
|
|
window.exportCurrentCrystal = exportCurrentCrystal; |
|
|
window.exportCompleteDataset = exportCompleteDataset; |
|
|
window.exportHuggingFace = exportHuggingFace; |
|
|
window.toggleFullscreen = toggleFullscreen; |
|
|
window.emergencyStop = emergencyStop; |
|
|
window.continueGeneration = continueGeneration; |
|
|
</script> |
|
|
</body> |
|
|
</html> |
|
|
|