FORUMS: list search recent posts

# Move in an arc motion from one position to another

FAQ   •   VIEW ALL
 Move in an arc motion from one position to another by Jon Dateon Sep 29, 2013 at 3:05:35 pm

I've been trying to get a layer to move from one position to another position in a semi circle motion. Does any one have any tips for this? For example I have a layer at 100,100 in x,y and the second position is at 1300,1300. I would like the an expression that moves the layer from point A to point B in an arc motion over a period of time. The reason why I don't just use a motion path is because the second,and then third, fourth position will be random. Any ideas would be very much appreciated.

 Re: Move in an arc motion from one position to anotheron Sep 29, 2013 at 11:57:39 pm

It depends on the details, but it could look like this:

p1 = [100,100];
p2 = [1300,1300];
dur = 1;

center = (p1+p2)/2;
r = length(p1,p2)/2;
p0 = p1-center;
a0 = Math.atan2(p0[1],p0[0]);
a = a0 + linear(time,inPoint,inPoint + dur,0,Math.PI);
center + [Math.cos(a),Math.sin(a)]*r;

Dan