Perlin noise plot graphic
in
Programming Questions
•
2 years ago
Hi!!
I wrote this little code to plot a updated graphic of a Perlin noise in a 720x240 window , this is done
by shiftting the plot to left side of the window each second; but the plot is updated only when I minimize
and again maximize the window. Where is my mistake? Can someone help me?
Thanks, planctum.
//Plot Perlin Noise
//by planctum, nov30.2010,version:1.0
int i=0;
int j=0;
int k=0;
int n=1000;
int prevMillis=0;
int tamMatrx=3000;
int amplitude=300;
float p=0.0;
float[] m=new float[tamMatrx];
//
void setup(){
size(720,240);
for(j=0; j<tamMatrx; j++){
m[j]=noise(p);
p+=0.01;
strokeWeight(1.5);
smooth();
}
}
//
void draw(){
for (k=0; k<= tamMatrx; k++){
j=k;
background(255);
for(i=0; i<=width; i++){
point(i, amplitude*m[j]);
j++;
}
prevMillis=millis();
while(millis() - prevMillis <= n){ }
}
}
1