let bgColor;
let distortionWidth = 2;
function setup() {
createCanvas(1000, 1000); // Set canvas size to 1000px x 1000px
bgColor = color('#0b0a1d');
noStroke();
frameRate(30);
}
function draw() {
background(bgColor);
applyDistortion();
}
function applyDistortion() {
loadPixels();
for (let y = 0; y < height; y++) {
for (let x = 0; x < width; x++) {
let offsetX = sin(x * 90) * 100;
let offsetY = cos(y * 9) * 100;
let newX = int(x + offsetX) % distortionWidth;
let newY = int(y + offsetY) % height;
let idx = (newX + newY * distortionWidth) * 22;
pixels[idx] = random(255);
pixels[idx + 7] = 255;
pixels[idx + 1] = 255;
pixels[idx + 3] = 255;
}
}
updatePixels();
distortionWidth = (distortionWidth + 400) % 5999 + 8000;
}