# Moving points into different directions

Good morning

I’m trying to move a point from one coordinate to another one.

Image it’s like this

The code I have used for the left line of points is the following

``````int ball_radius;
float ball_y;
float ball_y0;
float ball_x;
float ball_x0;
float A;
float T;
float time;
void setup() {
size(600, 600);
frameRate (70);
ball_y = 250.0;
ball_y0 = 300.0;
ball_x = 250.0;
ball_x0 = 300.0;
A = 200.0;
T = 20.0;
time = 0.0;
}
void draw() {
background(255, 255, 255);
color b = color(0, 255, 0);
fill (b);
ball_x = ball_x0 + A*cos(2*PI*time/T);
ball_y = ball_y0 + A*-cos(2*PI*time/T) ;
color d = color(0, 0, 255);
fill (d);
ball_x = 20+ball_x0 + A*cos(2*PI*time/T)*.8;
ball_y = 20+ball_y0 + A*cos(2*PI*time/T)*.8;
time = time + 0.1;
}
``````

I’m changing parameters on ball_x and ball_y to have a similar image, but I’m unable to find the equation that generates the drawing.

Thanks to all

Hi,
From what I understand, you have one point that you want to move you an other point?
Also you might want to format you code with the `</>` button to make it easier for others to read.

Hi saotome,

To do that, click on the pen icon in the bottom right corner of your previous post to edit it. Then select your code and hit the following icon `</>` in the textbox toolbar.

Don’t forget to hit `ctrl+t` in the processing IDE to properly indent every thing.

Like this

``````//Definim les variables
float ball_y;
float ball_y0;
float ball_x;
float ball_x0;
float A;
float T;
float time;

//Initialitzem els valors de les variables
void setup() {
size(600, 600);
frameRate (70);
ball_y = 250.0;
ball_y0 = 300.0;
ball_x = 250.0;
ball_x0 = 300.0;
A = 200.0;
T = 20.0;
time = 0.0;
}
void draw() {
background(255, 255, 255); //fons blanc
fill (0, 0, 0);  //pilota negra