FORUMS: list search recent posts

Interpolate between multiple cameras from diferent comps.

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Miguel de Mendoza
Interpolate between multiple cameras from diferent comps.
on Aug 29, 2015 at 8:12:52 am

Hello, I am working on a project with several scenes with his own camera. Each camera has its own animation directed via keys/expressions. The idea was to use a main camera that interpolates from one camera to another, using markers as triggers. I am using the expression bellow on the point of interest on the main camera. The position follows the poi with it's own z value.

The thing is that in this way I only can interpolate between two cameras. Thus linking 'main cameras' could go but then the workspace becomes very cumbersome. I was thinking to use a text layer or markers to store references to the cameras, and then interpolate between all of them in one camera. It is any way to use linear(), ease(), etc.. several times in the same expression?

camera1 = comp("Secene_1").layer("Camera 1");
camera2 = comp("Secene_2").layer("Camera 2");

offset1 = comp("Secene_1").layer("Camera 1").startTime;
offset2 = comp("Secene_2").layer("Camera 2").startTime;

poi1 = camera1.transform.pointOfInterest.valueAtTime(time + offset1);
poi2 = camera2.transform.pointOfInterest.valueAtTime(time + offset2;

t1 = marker.key("Camera 1").time;
t2 = marker.key("Camera 2").time;

ease(time, t1, t2, poi1, poi2)


Return to posts index


Xavier Gomez
Re: Interpolate between multiple cameras from diferent comps.
on Aug 30, 2015 at 9:13:00 pm
Last Edited By Xavier Gomez on Aug 31, 2015 at 11:15:24 am

Yes you can identify the current marker segment using maker.nearestKeyIndex(time) method.

If you set the marker comments as "comp name - camera layer name", normally the following should reproduce your example (i didnt check).


try{
K = marker.numKeys;
if (time<=marker.key(1).time){
k1=k2=1;
}
else if (marker.key(K).time<=time){
k1=k2=K;
}
else{
k = marker.nearestkeyIndex(time);
if (time===marker.key(k).time){
k1=k2=k;
}
else{
if (time<marker.key(k).time) --k;
k1=k;
k2=k+1;
};
};
comm1 = marker.key(k1).comment.split(" - ");
camera1 = comp(comm1[0]).layer(comm1[1]);
poi1 = camera1.transform.pointOfInterest.valueAtTime(time + camera1.startTime);

if (k1===k2){
poi1;
}
else{
comm2 = marker.key(k2).comment.split(" - ");
camera2 = comp(comm2[0]).layer(comm2[1]);
poi2 = camera2.transform.pointOfInterest.valueAtTime(time + camera2.startTime);

ease(time, marker.key(k1).time, marker.key(k2).time, poi1, poi2);
};
}
catch(e){
value;
};



Xavier.


Return to posts index

Miguel de Mendoza
Re: Interpolate between multiple cameras from diferent comps.
on Aug 31, 2015 at 3:41:15 pm

It works perfect, very very usefull for the complex camera rigging I'm trying to achieve. Lots of thanks!

I had to make an edit on the first if/else statment on k value assignement:

k = marker.nearestKey(time).index;
//Instead of:
k = marker.nearestkeyIndex(time);


Return to posts index


Xavier Gomez
Re: Interpolate between multiple cameras from diferent comps.
on Aug 31, 2015 at 9:08:30 pm

Ok sorry, i hadn't tried the code and i mixed things up.
Thanks for correction.

Xavier.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]