I'm trying to replicate your demo but for some reason perlin.get() is always returning 0 or -0.
Is there anything obviously wrong with this?
perlin.seed();
for (var y = 0; y < 200; y += 1){
for (var x = 0; x < 200; x += 1){
const random = parseInt((perlin.get(x, y) / 2 + 0.5) * 255);
context.fillStyle = `rgb(${random},${random},${random})`;
context.fillRect(x, y, 1, 1);
}
}
I had the same issue, I solved it by (in your case) making the x and y parameters smaller. You can try dividing them by 10 or even 100, it should work then.
I'm trying to replicate your demo but for some reason
perlin.get()
is always returning0
or-0
.Is there anything obviously wrong with this?