Spaces:
Running
Running
File size: 1,489 Bytes
1e4df75 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
// Create binary code columns in the background
document.addEventListener('DOMContentLoaded', function() {
createBinaryBackground();
});
function createBinaryBackground() {
const container = document.body;
const numColumns = 15; // Number of binary columns to create
for (let i = 0; i < numColumns; i++) {
const column = document.createElement('div');
column.className = 'binary-column';
// Random position
column.style.left = `${Math.random() * 100}%`;
// Random animation duration between 10-30s
const duration = 10 + Math.random() * 20;
column.style.animation = `binary-flow ${duration}s linear infinite`;
// Random delay so they don't all start at once
column.style.animationDelay = `${Math.random() * 10}s`;
// Generate binary content
column.innerHTML = generateBinaryString();
container.appendChild(column);
}
}
function generateBinaryString() {
let result = '';
const length = 50 + Math.floor(Math.random() * 100); // Random length between 50-150 characters
for (let i = 0; i < length; i++) {
// Mostly 0s and 1s, but occasionally add a CVE reference
if (Math.random() < 0.01) {
result += '<span style="color: rgba(0, 188, 212, 0.3);">CVE</span><br>';
} else {
result += Math.round(Math.random()) + '<br>';
}
}
return result;
}
|