miércoles, 16 de abril de 2008

Espiral



import ddf.minim.*;

AudioInput in;

float acumulador;

void setup ()
{
size(200,200);
background(255,255,255);
Minim.start(this);
in = Minim.getLineIn(Minim.MONO);
}

void draw ()
{
//background(255,255,255);
fill(255,255,255,10);
rect(0,0,width,height);
float radio;
strokeWeight(2);
for(int i = 0; i < 20; i++)
{
float muestra = in.left.get(i);
radio = 40 + (muestra*60);
stroke(200-(radio *2), i * 2,acumulador , abs(muestra)* 150);
float angulo = TWO_PI * i/20;
float x = radio * sin(angulo);
float y = radio * cos(angulo);
noFill();
ellipse(x + 100,y + 100, 120, 120);
}
acumulador = acumulador + 6;
if (acumulador > 255)
{
acumulador = 0;
}

}

No hay comentarios: