Hey NoahBuddy
thanks for the reply, i do gain much from your comments because that type of feedback is exactly what i was looking for
i did most of what you said except add the update(float f1, float f2) method
by "random set points" I am assuming you mean the set x positions in my bezier curves which are placed randomly, which I define in my constructor:
Code:
Wave(float x1, float x2) {
b1x = x1;
b2x = x2;
what is the purpose of making a seperate method for this. i know update methods are used frequently, but my display method updates my values effected by sin and cos.
heres all my updated code:
Code:
//Trig Strings : By Drew Ratliff
//trig stuff
float angle = 0.0;
float speed = .05;
//radius
float range = 300;
Wave[] wavers;
void setup() {
smooth();
size (750,300);
wavers = new Wave[100];
for(int i = 0; i < wavers.length; i++) {
//random set x for... bezier1 bezier2
wavers[i] = new Wave(int(random(width)),int(random(width)));
}
}
void draw () {
//set background, make random same, translate to middle
background(0);
randomSeed(6);
translate(0,height/2);
for(int i = 0; i < wavers.length; i++) {
wavers[i].display();
//wavers[i].update();
}
angle += speed;
}
class Wave {
float b1x;
float b1y;
float b2x;
float b2y;
float sinval;
float cosval;
color neons;
Wave(float x1, float x2) {
b1x = x1;
b2x = x2;
neons = color(random(255),random(255),random(200,255),random(100,200));
}
void display() {
//Trig Math for motion
sinval = sin(random(angle));
cosval = cos(random(angle));
float b1y = (sinval * range);
float b2y = (cosval * range);
stroke(neons);
//draw string
noFill();
beginShape();
vertex(0,0);
bezierVertex(b1x,b1y,b2x,b2y,width,0);
endShape();
}
/*void update() {
sinval = sin(random(angle));
cosval = cos(random(angle));
float b1y = (sinval * range);
float b2y = (cosval * range);
}*/
}
i know i probablly sound like an idiot, im just trying to make sense of it to learn for myself
thx for replying and giving me your input