Tuesday, November 17, 2009
superposition
/*
* SuperPosition
* by PixelPusher
*
* Inspired by http://www.bugman123.com/Physics/Physics.html
*
* two radiating points in contrasting colors
* Have a blast with it...
*/
int frames;
int maxFrames;
int numElipses;
void setup()
{
size(256, 256);
ellipseMode(CENTER);
noFill();
strokeWeight(4);
frames = 0;
maxFrames = 3;
numElipses = 40;
frameRate(4);
}
void draw()
{
background(100);
smooth();
frames = (frames+1) % maxFrames;
pushMatrix();
translate(0, height/4);
stroke(200, 0, 180);
drawEllipses(numElipses);
translate(0, height/2);
stroke(0, 200, 180);
drawEllipses(numElipses);
popMatrix();
}
void drawEllipses(int num)
{
for (int i=0; i<num; i++)
{
if ( (i % maxFrames) == frames)
{
float w = 2*256.0*i/num;
ellipse(0, 0, w, w);
}
}
}
boolean odd(int n)
{
return ((n % 2) == 0);
}
boolean even(int n)
{
return !odd(n);
}
* SuperPosition
* by PixelPusher
*
* Inspired by http://www.bugman123.com/Physics/Physics.html
*
* two radiating points in contrasting colors
* Have a blast with it...
*/
int frames;
int maxFrames;
int numElipses;
void setup()
{
size(256, 256);
ellipseMode(CENTER);
noFill();
strokeWeight(4);
frames = 0;
maxFrames = 3;
numElipses = 40;
frameRate(4);
}
void draw()
{
background(100);
smooth();
frames = (frames+1) % maxFrames;
pushMatrix();
translate(0, height/4);
stroke(200, 0, 180);
drawEllipses(numElipses);
translate(0, height/2);
stroke(0, 200, 180);
drawEllipses(numElipses);
popMatrix();
}
void drawEllipses(int num)
{
for (int i=0; i<num; i++)
{
if ( (i % maxFrames) == frames)
{
float w = 2*256.0*i/num;
ellipse(0, 0, w, w);
}
}
}
boolean odd(int n)
{
return ((n % 2) == 0);
}
boolean even(int n)
{
return !odd(n);
}
comments
loading...
Add a comment: