We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Ramps, Envelopes
Page Index Toggle Pages: 1
Ramps, Envelopes (Read 664 times)
Ramps, Envelopes
Aug 16th, 2005, 3:18am
 
Hello,

I have been building this program and trying to make smooth moving curves that will move back and forth across the screen and I think my ramp or "return" section of this program is not working correctly. What I would like it to do is have the vertex points move back and forth so they effect the curve of the line. Thanks for any help. Here is the code.

float x1 = 0.0;
float x2 = 0.0;
float shake = 0.0;

void setup(){
size (400,400);
framerate(60);
}

void draw(){
background(204);
x1++;
x2--;
/*x1= x1 + (1.0 * shake);
if (x1 >= 50 || x1 <= 0){
shake = shake * -1;
}
else{
x2 =x2 -1.0;
if (x2<=0){
shake =1;
}

}*/
beginShape(LINE_STRIP);
curveVertex(84,  91);
curveVertex(x1+81,  91+x1);
curveVertex(68,  19);
curveVertex(21,  x1+17);
curveVertex(32+x1, 100+x2);
curveVertex(32+x1, 100);
endShape();
}
Page Index Toggle Pages: 1