Problem with a line
in
Programming Questions
•
2 years ago
Hey guys,
I'm working on this sound reacted graphic code. When the shape fades out, you can see a cross line underneath the circles, that's because of the rectangle. And when i delete the rectangle it doesn't fade out. I didn't understand how to fix it...
PS: you might need a mic and music to see what's wrong.
Thank you.
...........................
import ddf.minim.*;
import processing.opengl.*;
PVector field;
float x0 , y0 , z0;
float h, a, b, c, n;
float depth = 50;
float dir = -10;
float alpha = -500;
Minim minim;
AudioInput snd;
float snd_level;
void setup() {
size(1024,500, P3D, OPENGL);
background(0);
colorMode(HSB, 250);
noFill();
smooth();
minim = new Minim(this);
snd = minim.getLineIn(Minim.STEREO, 512);
field = new PVector(width/2, height * 0.5);
x0 = (random(50) - 25) / 2+snd_level*3;
y0 = 1+snd_level*3;
z0 = random(50) / 2+snd_level*3;
h = 0.01;
a = 10.0;
b = 28.0;
c = 8.0 / 3.0;
n = 0;
}
void draw() {
snd_level =snd.mix.level()*3;
fill(200,50);
float x1 = x0+h * a+snd_level*1 * (y0 - x0);
float y1 = y0+ h * (x0 * (b+snd_level*1 - z0) - y0);
float z1 = z0+ h * (x0* y0+ - c * z0);
float cameraZ = -height/1;
float cameraX = -width+snd_level*30/1;
translate(width/50, height/50, -depth);
rotateZ(PI*49.999);
stroke(0, 50);
ellipse(y0*10 + field.x, x0*10 + field.y, 50*z0*5 / 100, 50*z0*5 / 100);
alpha += dir;
fill( 0, alpha );
rect( 0, 0, width, height );
if( alpha < 0 || alpha > 255 ) dir *= -1;
// solution becomes next seed
x0 = x1;
y0 = y1;
z0 = z1;
//println((y0*10 + field.x) + " " + (x0*10 + field.y) + " " + z0*2);
}
I'm working on this sound reacted graphic code. When the shape fades out, you can see a cross line underneath the circles, that's because of the rectangle. And when i delete the rectangle it doesn't fade out. I didn't understand how to fix it...
PS: you might need a mic and music to see what's wrong.
Thank you.
...........................
import ddf.minim.*;
import processing.opengl.*;
PVector field;
float x0 , y0 , z0;
float h, a, b, c, n;
float depth = 50;
float dir = -10;
float alpha = -500;
Minim minim;
AudioInput snd;
float snd_level;
void setup() {
size(1024,500, P3D, OPENGL);
background(0);
colorMode(HSB, 250);
noFill();
smooth();
minim = new Minim(this);
snd = minim.getLineIn(Minim.STEREO, 512);
field = new PVector(width/2, height * 0.5);
x0 = (random(50) - 25) / 2+snd_level*3;
y0 = 1+snd_level*3;
z0 = random(50) / 2+snd_level*3;
h = 0.01;
a = 10.0;
b = 28.0;
c = 8.0 / 3.0;
n = 0;
}
void draw() {
snd_level =snd.mix.level()*3;
fill(200,50);
float x1 = x0+h * a+snd_level*1 * (y0 - x0);
float y1 = y0+ h * (x0 * (b+snd_level*1 - z0) - y0);
float z1 = z0+ h * (x0* y0+ - c * z0);
float cameraZ = -height/1;
float cameraX = -width+snd_level*30/1;
translate(width/50, height/50, -depth);
rotateZ(PI*49.999);
stroke(0, 50);
ellipse(y0*10 + field.x, x0*10 + field.y, 50*z0*5 / 100, 50*z0*5 / 100);
alpha += dir;
fill( 0, alpha );
rect( 0, 0, width, height );
if( alpha < 0 || alpha > 255 ) dir *= -1;
// solution becomes next seed
x0 = x1;
y0 = y1;
z0 = z1;
//println((y0*10 + field.x) + " " + (x0*10 + field.y) + " " + z0*2);
}
1