Fade out extension
in
Core Library Questions
•
2 years ago
Hey guys,
This is a sound reacted design. I need to extend the time of the white circles before they fade out to blue. How can I do that?
import ddf.minim.*;
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(1286,804, P3D);
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;
y0 = 1;
z0 = random(50) / 2;
h = 0.01;
a = 10.0;
b = 28.0;
c = 8.0 / 3.0;
n = 0;
}
void draw() {
snd_level =snd.mix.level()*10;
fill(200,20);
float x1 = x0+snd_level*1+h * a * (y0 - x0);
float y1 = y0+snd_level-1+ h * (x0 * (b - z0) - y0);
float z1 = z0+ h * (x0* y0+ - c * z0);
rotateZ(PI*49.999);
stroke(0, 50);
ellipse(y0*10 + field.x, x0*10 + field.y, 50*z0*5 / 100, 50*z0*5 / 100);
// Fade out olmasini saglayan asagidaki kod
noSmooth();
alpha += dir;
fill(380, alpha);
rect( 0, 0, width, height );
if( alpha < 0 || alpha > 1000 ) dir *= 100;
x0 = x1;
y0 = y1;
z0 = z1;
//println((y0*10 + field.x) + " " + (x0*10 + field.y) + " " + z0*2);
}
1