Hi! I have a small little noise graphing code I would love to port to p5.js and have a hard time finding out what needs to change so this code (which works in processing) works in p5.js
Thank you javager,
this was the right start. Had to translate a couple of other expressions too:
“Size” to “createCanvas”
“void” to “function”
But now it works as expected in p5.js
Working code:
let inc = 0.05;
let start = 0;
function setup(){
createCanvas(600,400);
}
function draw() {
background(0);
stroke(255);
noFill();
beginShape();
let xoff = start;
for (let x = 0; x < width; x +=3) {
stroke(255);
strokeWeight(2);
let y = map(noise(xoff),0,1,050,350);
vertex(x,y);
xoff += inc;
noiseDetail(10,0.5);
}
endShape();
start += inc;
}