бля
Line myLine;
int[] gx;
int[] g;
float a, b, c;
float x1 = -200;
float y1 = 0;
float x2, y2, x3, y3, x4, y4;
void setup() {
size(1500,900);
myLine = new Line(a, x1, y1, x2, y2);
g = new int[width];
}
void draw() {
translate(width/2, height/2);
background(80);
ellipse(-200,0, 400, 400);
myLine.move();
myLine.display();
}
class Line{
float x1;
float y1;
float x2;
float y2;
Line( float ta, float tx1, float ty1, float tx2, float ty2){
a = ta;
x1 = tx1;
y1 = ty1;
x2 = tx2;
y2 = ty2;
}
void display(){
line(x1,y1,x2,y2);
ellipse(x2, y2, 200, 200);
line(x2,y2,x3,y3);
ellipse(x3, y3, 100, 100);
line(x3,y3,x4,y4);
for (int i = g.length-1; i > 0; i--){
g[i] = g[i-1];
}
g[0] = int(y4);
for (int i = 1; i < g.length; i++){
line(i, g[i], i-1, g[i-1]);
}
}
void move(){
x2 = cos(a) * 200 +x1;
y2 = sin(a) * 200 +y1;
a = a + 0.01;
x3 = cos(b) * 100 +x2;
y3 = sin(b) * 100 +y2;
b = b + 0.03;
x4 = cos(c) * 50 +x3;
y4 = sin(c) * 50 +y3;
c = c + 0.06;
}
}