-
Camera positioning expression
Hello,
I don’t even know where to begin, but I have to make amends to the camera animation that someone else had created. Camera movements are controlled by the following expression. I have 6 navigation points to adjust at the moment but I have to add 7 more points to animate the entire scene, but it’s just too difficult for me to get my head around, if anyone can figure it out or explain to me the following expression will be super super appreciated!
rSt=thisComp.layer("EDIT").effect("StartRadius")("ADBE Slider Control-0001");
rMid=thisComp.layer("EDIT").effect("MiddleRadius")("ADBE Slider Control-0001");
rEnd=thisComp.layer("EDIT").effect("EndRadius")("ADBE Slider Control-0001");SA=thisComp.layer("EDIT").effect("StartAngle")("ADBE Angle Control-0001");
EA=thisComp.layer("EDIT").effect("EndAngle")("ADBE Angle Control-0001");m1=thisComp.layer("L3").effect("m1")("ADBE Slider Control-0001");
m2=thisComp.layer("L3").effect("m2")("ADBE Slider Control-0001");
m3=thisComp.layer("L3").effect("m3")("ADBE Slider Control-0001");
m4=thisComp.layer("L3").effect("m4")("ADBE Slider Control-0001");
m5=thisComp.layer("L3").effect("m5")("ADBE Slider Control-0001");
m6=thisComp.layer("L3").effect("m6")("ADBE Slider Control-0001");timeNew=thisComp.layer("Marker").effect("Marker_0-5000")("ADBE Slider Control-0001");
tN=ease(timeNew, m1, m6, [0], [1]);
Rad=Math.pow(1-tN, 2)*rSt+2*tN*(1-tN)*rMid+Math.pow(tN, 2)*rEnd;
P1=thisComp.layer("P1").transform.position;
P2=thisComp.layer("P2").transform.position;
P3=thisComp.layer("P3").transform.position;
P4=thisComp.layer("P4").transform.position;
P5=thisComp.layer("P5").transform.position;
P6=thisComp.layer("P6").transform.position;P0=[P1[0]+Rad, P1[1]];
P02=[P6[0]-Rad, P6[1]];t11=easeIn(timeNew, m1, m2, [0], [1]);
t22=linear(timeNew, m2, m3, [0], [1]);
t33=linear(timeNew, m3, m4, [0], [1]);
t44=linear(timeNew, m4, m5, [0], [1]);
t55=easeOut(timeNew, m5, m6, [0], [1]);if(timeNew= m2 && timeNew=m3 && timeNew=m4 && timeNew=m5) t5=1 else t5=0;
t=t11*t1+t22*t2+t33*t3+t44*t4+t55*t5;
pM2=(P1+P2+P3+P4+P5+P6)/6;
n1=thisComp.layer("P1").transform.position;
n2=thisComp.layer("P2").transform.position;
n3=thisComp.layer("P3").transform.position;
n4=thisComp.layer("P4").transform.position;
n5=thisComp.layer("P5").transform.position;
n6=thisComp.layer("P6").transform.position;L1=length(P0, pM2);
L2=length(P0, P1);
L3=length(P1, pM2);L12=length(P02, pM2);
L22=length(P02, P6);
L32=length(P6, pM2);q=(Math.pow(L2, 2)+Math.pow(L3, 2)-Math.pow(L1, 2))/(2*L2*L3);
a=Math.acos(q);
a2=radiansToDegrees(a);
a3=ease(a2, 0, 180, [135+SA], [45+SA]);q22=(Math.pow(L22, 2)+Math.pow(L32, 2)-Math.pow(L12, 2))/(2*L22*L32);
a22=Math.acos(q22);
a222=radiansToDegrees(a22);
a322=ease(a222, 180, 0, [45+EA], [135+EA]);
u=ease(tN, 0, 1, [a3], [a322]);a4=degreesToRadians(u);
r1=[n1[0]+Rad*Math.cos(a4), n1[1]+Rad*Math.sin(a4)];
r2=[n2[0]+Rad*Math.cos(a4), n2[1]+Rad*Math.sin(a4)];
r3=[n3[0]+Rad*Math.cos(a4), n3[1]+Rad*Math.sin(a4)];
r4=[n4[0]+Rad*Math.cos(a4), n4[1]+Rad*Math.sin(a4)];
r5=[n5[0]+Rad*Math.cos(a4), n5[1]+Rad*Math.sin(a4)];
r6=[n6[0]+Rad*Math.cos(a4), n6[1]+Rad*Math.sin(a4)];r12=(r1+r2)/2;
r22=(r2+r3)/2;
r32=(r3+r4)/2;
r42=(r4+r5)/2;
r52=(r5+r6)/2;
r61=r52;
r21=2*r2-r22;
r31=2*r3-r32;
r41=2*r4-r42;
r51=2*r5-r52;rv11=(1-t11);
rv21=Math.pow(rv11, 2);
rv31=Math.pow(rv11, 3);
tp21=Math.pow(t11, 2);
tp31=Math.pow(t11, 3);
rv12=(1-t22);
rv22=Math.pow(rv12, 2);
rv32=Math.pow(rv12, 3);
tp22=Math.pow(t22, 2);
tp32=Math.pow(t22, 3);
rv13=(1-t33);
rv23=Math.pow(rv13, 2);
rv33=Math.pow(rv13, 3);
tp23=Math.pow(t33, 2);
tp33=Math.pow(t33, 3);
rv14=(1-t44);
rv24=Math.pow(rv14, 2);
rv34=Math.pow(rv14, 3);
tp24=Math.pow(t44, 2);
tp34=Math.pow(t44, 3);
rv15=(1-t55);
rv25=Math.pow(rv15, 2);
rv35=Math.pow(rv15, 3);
tp25=Math.pow(t55, 2);
tp35=Math.pow(t55, 3);
rY1=rv31*r1+3*t11*rv21*r12+3*tp21*rv11*r21+tp31*r2;
rY2=rv32*r2+3*t22*rv22*r22+3*tp22*rv12*r31+tp32*r3;
rY3=rv33*r3+3*t33*rv23*r32+3*tp23*rv13*r41+tp33*r4;
rY4=rv34*r4+3*t44*rv24*r42+3*tp24*rv14*r51+tp34*r5;
rY5=rv35*r5+3*t55*rv25*r52+3*tp25*rv15*r61+tp35*r6;r=t1*rY1+t2*rY2+t3*rY3+t4*rY4+t5*rY5;