We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello! I want to locate circles like on the picture (red colour). I want change variable "n" to change ammount of circles (now n=4). I want every sircle moves to his right position and stop.
Sorry for newby question.
float gradx;
float x ;
float grady;
float y;
float easing = 0.01;
//float diameter = 12;
int rad = 100;
int n = 4;
float [] step = new float [n];
//float [] yy = new float [n];
void setup() {
size(500, 500);
//translate (250,250);
smooth();
for (int i = 0; i <= n-1; i++)
{
step[i] = 360/n * i;
}
;
}
void draw() {
translate (250,250);
background (0);
ellipse(0 , 0, 200, 200);
circle(n);
}
void circle (int n)
{
for (int i = 0; i <= n-1; i++)
{
float target_anglex = step[i];
gradx += (target_anglex - gradx) * easing;
println(gradx);
x = cos(radians(gradx))* rad;
println(x + "+");
float target_angley = step[i];
grady += (target_angley - grady) * easing;
y = sin(radians(grady)) * rad;
noFill();
ellipse(x , y, 30, 30);
//ellipse(x+20 , y+20, 12, 12);
stroke(255);
//line (300,300,x,y);
//println(x +"+"+ y);
}
}
Answers
Got it.