We are about to switch to a new forum software. Until then we have removed the registration on this forum.
So I have a noise wave, and I have used a for loop to make points that travel under it, and I want them to stop at another perlin noise wave. Btw my code is really bad because I'm just a beginner :'(
This is my code:
float inc = 0.04;
void setup() {
size(640, 500);
}
void draw() {
background(255);
float xoff=0;
float xoff2=0;
xoff2 += inc;
stroke(245, 10, 100);
strokeWeight(1.5);
for (float x = 0; x < width; x++) {
float y = noise(xoff) * 200;
point(x, y);
float t = noise(xoff2) * 400;
//i+=5 = the space between the points vertically
for (float i = y; i < t; i+=5) {
point(x, i);
}
xoff += inc;
x = x + xoff + 4;
}
}
Answers
When you mean travel like an animation
look at lerp() command in the reference
I just mean like this^ but see at the bottom how they kind of just sit in a straight line? i want the bottom to also be curved
like to also be another perlin noise wave
where are you incrementing xoff2?
I thought that it would make another wave? hahah i don't really know im so lost :(
I don’t think you need two For loops
You only need one for x
both horizontal lines have the same x per column/ point
What‘s different is the y: you have an upper y, name it y1 and a lower one y2
your line command: line (x, y1, x, y2);
calculate the two y values with noise and use different xoffset values
Hit ctrl-t
Post your entire code
will this work for points though? even though you are using the line command?
Do the line thing first
That’s the requirement
Ah, you tried this already
Also look at command lerp() in the reference
you are drawing a lines in a loop. each line goes between y and t
which is fair enough.
so y changes when xoff changes and t changes when xoff2 changes. which brings me back to...