Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects syncing Camera’s position Keyframes with Layer startTimes

  • syncing Camera’s position Keyframes with Layer startTimes

    Posted by Aled Rhys jones on October 30, 2006 at 6:33 pm

    I have a comp that has 4 nested comps (set to 3D) and a Camera.
    The 4 nested comps come in at different times in the timeline.
    They are arranged side to side (next to each other on the X axis like posters on a wall).
    The Camera moves from one comp to the next accross in the X axis, pauses, then shifts to the next comp. This move is set to take varying amounts of time from one ‘poster’ to the next. (all-in-all there are 8 keyframes).

    I would like to set up the comp so that the editor can ‘slip’ any of the comps in the timeline without having to worry about moving the keyframes of the camera.

    i.e.:
    Whatever the startTime of nested Comp 1, Keyframe (1) is synced with it.
    Keyframe (2) is always 0.92 seconds after Keyframe (1).
    Whatever the startTime of nested Comp 2 is, Keyframe (3) is synced with it.
    Keyframe (4) is always 1.24 sec after Keyframe (3).
    …and so on.

    I hope I’ve made sense and that someone out there can help.

    Kind Regards

    Al

    Filip Vandueren replied 19 years, 6 months ago 2 Members · 1 Reply
  • 1 Reply
  • Filip Vandueren

    October 31, 2006 at 2:51 am

    This works:


    // <
    l=[];
    // the 4 nested compLayers
    l[0]=thisComp.layer("Comp 1");
    l[1]=thisComp.layer("Comp 2");
    l[2]=thisComp.layer("Comp 3");
    l[3]=thisComp.layer("Comp 4");

    d=[];
    // the 4 delaytimes:
    d[0]=0.92;
    d[1]=1.24;
    d[2]=0.2;
    d[3]=0.2;

    value;
    for (i=0; i<4; i++) {
    if (l[i].inPoint<time) {
    linear (time, l[i].inPoint, l[i].inPoint + d[i] , key(i*2+1).value, key((i+1)*2).value);
    if ((i<l.length-1) && (l[i].inPoint + d[i] <time)) {
    linear (time, l[i].inPoint + d[i], l[i+1].inPoint, key((i+1)*2).value, key(i*2+3).value);
    }
    }
    }

    NB:
    – you can change the two occurences of linear to ease, easeIn or easeOut if you prefer that.
    – IMPORTANT: if you see “& lt ;” in the first line instead of a “lesser than” sign in the first line of the script, go to the webiste and copy the expression from there !

    The thing about these kinds of solutions is, that if your editor is after-effects-agnostic enough to not be able to move 2 keyframes, he sure as hell won’t know what to do when a bunch of javascript errors pop up after he accidentally removes a layer. Undo will restore the layer, but not the expression…

    So this is more of a ‘proof-of-concept’ expression than a recommendation for a workflow if you catch me 😉

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