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.
IndexDiscussionExhibition › Lissajous curve variation
Page Index Toggle Pages: 1
Lissajous curve variation (Read 1096 times)
Lissajous curve variation
Aug 19th, 2007, 1:06pm
 
draw nice interference patterns between folded sheets

//lissajous1
//alphachapmtl
//2007-aug-17

int n=800;//image size
int margin=8;
float n2,n4;

void setup() {
 int nn=n-2*margin;
 n2=nn/2.00;
 n4=nn/4.00;
 int maxWidth=n;
 int maxHeight=n;
 size(n,n);
 background(0);
 noFill();
 ellipseMode(CENTER);
 noLoop();
}

void draw() {
 int r,g,b,a;
 float x,y,w,h;
 //initial color
 r=0;
 g=100;
 b=200;
 a=30;
 for (int t = 0; t < 2000; t++) {
   float tt=t*TWO_PI/500;
   //change color
   r=(r+10)%255;
   g=(g+15)%255;
   b=(b+20)%255;
   //a=(a+2)%50;
   stroke(r,g,b,a);
   //set center x,y
   x=margin+n4+n4*(1+sin(1.0*tt));//change the 1.0, the sin(), ...
   y=margin+n4+n4*(1+cos(2.0*tt));//change the 2.0, the cos(), ...
   //set width,height
   w=n2*sin(3.0*tt);//change the 3.0, the sin(), ...
   h=n2*cos(2.0*tt);//change the 2.0, the cos(), ...
   //draw ellipse
   ellipse(x, y, w, h);
 }//for
}

/*try those:
x=margin+n4+n4*(1+sin(2.0*tt));
y=margin+n4+n4*(1+sin(cos(1.0*tt)));
w=n2*sin(2.0*tt);
h=n2*sin(cos(3.0*tt));
or those:
x=margin+n4+n4*(1+sin(1.0*tt));
y=margin+n4+n4*(1+cos(1.5*tt));
w=n2*sin(2.0*tt);
h=n2*sin(cos(1.5*tt));
*/
Re: Lissajous curve variation
Reply #1 - Sep 6th, 2007, 10:57am
 
whoo - hoo. sweet.
Re: Lissajous curve variation
Reply #2 - Sep 14th, 2007, 6:38pm
 
LOL

nice one
Page Index Toggle Pages: 1