perlin net
@author
float stepNum = 25;
float stepSize = 20;
float noiseScale = 0.005;
float timeScale = 0.01;
void setup(){
size(500, 500);
}
void draw(){
noStroke();
fill(30, 144, 255, 30);
rect(0, 0, width, height);
noFill();
stroke(255, 255, 31);
strokeWeight(1);
for(int x = 1; x < stepNum; x++){
float w = x * stepSize;
beginShape();
curveVertex(w, 0);
curveVertex(w, 0);
for(int y = 1; y < stepNum; y++){
float h = y * stepSize;
float nw = map(noise(w * noiseScale, h * noiseScale, frameCount * timeScale), 0, 1, -stepSize, stepSize);
float nh = map(noise(w * noiseScale, h * noiseScale, frameCount * timeScale), 0, 1, -stepSize, stepSize);
curveVertex(w + nw, h + nh);
}
curveVertex(w, stepNum * stepSize);
curveVertex(w, stepNum * stepSize);
endShape();
}
for(int y = 1; y < stepNum; y++){
float h = y * stepSize;
beginShape();
curveVertex(0, h);
curveVertex(0, h);
for(int x = 1; x < stepNum; x++){
float w = x * stepSize;
float nw = map(noise(w * noiseScale, h * noiseScale, frameCount * timeScale), 0, 1, -stepSize, stepSize);
float nh = map(noise(w * noiseScale, h * noiseScale, frameCount * timeScale), 0, 1, -stepSize, stepSize);
curveVertex(w + nw, h + nh);
}
curveVertex(stepNum * stepSize, h);
curveVertex(stepNum * stepSize, h);
endShape();
}
}