Hi, thanks for your useful information
Processing is so new for me!
I have a code, simple pattern, and I try to have three of these in at the same time but I don't know how.
I appreciate if you guys help me
//this the code
int count = 20;
Ball balls[] = new Ball[count];
color c = color(0);
color sc = color(0);
color lc = color(0, 100);
float baseRadius;
float pulseRange = 0;
float a = 0; // starting angle
float vr = 0; // rotational velocity (speed of pulsing)0,1
int sensordata01=0;
float radius;
void setup() {
size(1350, 750);
baseRadius=height*3/4.0;
a += vr;
radius = baseRadius + sin(a) * pulseRange;//Starting from angle 0 it is 100 and @ angle 90 it is at its maximum which is 180 @ angle 135 it is 20
drawCircle(radius);
}
void draw() {
sensordata01=mouseX;
//balls[9].x=sensordata01;//connect to sensordata disposition
// float a = (balls[8].id*TWO_PI/count)+radians(sensordata01);//connect rotation of a ball to sensor data
// balls[9].x = width/2 + cos(a) * radius;
// balls[9].y = height/2 + sin(a) * radius*2.0/3.0;
background(255);
for (int i=0; i<balls.length; i++) {
balls[i].drawlines();
balls[i].draw();
}
}
void drawCircle(float radius) {
float vr = TWO_PI/count;
for (int i=0; i<count; i++) {
float a = i*vr;
float x = width/2 + cos(a) * radius*2.0/3.0;
float y = height/2 + sin(a) * radius*2.0/3.0;
balls[i] = new Ball(x, y, 10, i);
}
// balls[count] = new Ball(0, 0, 3, count);
// balls[count+1] = new Ball(width, 0, 3, count+1);
//balls[count+2] = new Ball(width, height, 3, count+2);
// balls[count+3] = new Ball(0, height, 3, count+3);
}
class Ball {
float x, y, s, vx, vy;
int id;
Ball(float x_, float y_, float s_, int id_) {
x = x_;
y = y_;
s = s_;
id = id_;
vx = 4;
vy = 3;
}
void draw() {
fill(c);
stroke(sc);
if(id==1){stroke(255,0,0);}
ellipse(x, y, s, s);//s radious of the ball circle
}
void drawlines() {
for (int i=id+1; i<balls.length; i++) {//Sequence connection
stroke(lc);
//if() frequency connection
line(x, y, balls[i].x, balls[i].y);
}
}
}