Hello there,
I have been working on this small program that I would like to use as a fullscreen background. However, it already is really heavy. Is there a way to fix that in my code or I just have to think of another way to use it?
var density = 0.03;
var wind = 0;
var speedOfWind = 0.00002;
function setup() {
canvas = createCanvas(500,500);
//canvas = createCanvas(windowWidth, windowHeight);
canvas.position(0,0);
canvas.style('z-index', -1);
pixelDensity(1);
// frameRate(100);
}
function draw() {
var yoff = 0;
// translate(advance, advance * 0.5);
loadPixels();
for (var y = 0; y < height; y++) {
var xoff = 0;
for (var x = 0; x < width; x++) {
var index = (x + y * width) * 4;
var r = noise(xoff + wind, yoff - wind) * 255;
pixels[index + 0] = r;
pixels[index + 1] = r;
pixels[index + 2] = r;
pixels[index + 3] = 51;
xoff += density;
}
yoff += density;
wind+= speedOfWind;
}
updatePixels();
}
Just to clarify:
I tried increasing the frameRate() to 100 or 200, but nothing changed.
I am using a MacBook Pro 2014 Retina, so I suppose my resolution is quite high.
Any help would be appreciated. It’s my first post on the forum. I don’t know if this way of posting code is okay, let me know.
All the best!