Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Interpolate between multiple cameras from diferent comps.

  • Interpolate between multiple cameras from diferent comps.

    Posted by Miguel De mendoza on August 29, 2015 at 8:12 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)

    Xavier Gomez replied 10 years, 8 months ago 2 Members · 3 Replies
  • 3 Replies
  • Xavier Gomez

    August 30, 2015 at 9:13 pm

    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

    Xavier.

  • Miguel De mendoza

    August 31, 2015 at 3:41 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);

  • Xavier Gomez

    August 31, 2015 at 9:08 pm

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

    Xavier.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy