Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Dan Ebberts ‘Follow the leader’

  • Dan Ebberts

    February 11, 2013 at 11:41 pm

    With just a quick look, I can see a couple of problems. The “end” variable in the expression needs to be set to the duration of your template animation (20 seconds in your case). The offset slider should probably be set to a fixed value (the desired spacing between your two elements). The travel slider is the one that should be keyframed to go from near zero to 100%.

    Dan

  • Kieren Smith

    February 12, 2013 at 12:01 am

    Hey Dan,

    Thank you for the quick reply.

    I have made the alterations you suggested. Set end var to 20, and set key frames at the start and end of the comp for the travel slider, starting on .05, ending on 100.

    The Front Carriage now moves along the path oriented the correct way, but every now and again it twitches and points in a different direction just for a split second then returns to face the correct way.

    The trailer is moving with the Front Carriage but it is not orienting to the path.

    Any suggestions? I can repost the file if you’d like to check it out.

    Cheers
    Kieren.

    __
    Insert Witty Banter

  • Dan Ebberts

    February 12, 2013 at 1:25 am

    Try turning off auto orient for both layers, changing the travel percentage range from 7 to 99, and use this expression for each of the two layer’s rotation property:

    strt = 0; //start time of template motion
    end = 20.0; //end time of template motion
    t = thisComp.layer(“template”);
    offset = (t.effect(“offset”)(“Slider”)/100)*(index -1);
    travel = linear(t.effect(“Travel Percentage”)(“Slider”)/100,strt,end);
    v = t.position.velocityAtTime(travel – offset);
    radiansToDegrees(Math.atan2(v[1],v[0]))

    Dan

  • Kieren Smith

    February 12, 2013 at 2:53 am

    YOU, good sir are a LEGEND!

    That sorted it all out…

    what makes 7 & 99 the magic numbers?

    If I added an Ease to the 2 end position frames on the Null object, and then roved the 2 middle keyframes…

    You will notice that the gap between the front Carriage and the Trailer increases & decreases due to the ease…

    Would there be any means to keep a constant gap between them no matter if there is an ease or not?
    I have attached the latest version here: 5430_fbv2v1.0followtheleadercopycs5.5.aep.zip

    When you scrub the timeline you can see that the Gap increases between the front and back.

    Man you are good.

    Cheers
    Kieren.

    __
    Insert Witty Banter

  • Dan Ebberts

    February 12, 2013 at 3:07 am

    7 and 99 seemed to be the values that keep both layers on the path. If they reach the end of the path, the rotation flips.

    Easing the template movement isn’t a good idea for exactly the reason you’ve discovered.

    You could ease your animation of the travel slider though–that should be fine.

    Dan

  • Kieren Smith

    February 12, 2013 at 3:20 am

    Dan, if you lived in New Zealand I’d get you a box of beer.

    This worked a charm!

    Cheers for the help,
    K.

    __
    Insert Witty Banter

  • Kieren Smith

    February 18, 2013 at 2:58 am

    Hi Dan,

    Is this the only way to make a follow the leader trail?

    Is there any way I could have a front carriage, then add few more carriages behind it and parent the carriages one after another to each other?

    I know this makes a rigid looking train when oriented to a path, but there must be some sort of a way to make the carriages turn at the right time…

    Maybe using the value at time expression which the delay is controlled by a slider…? I don’t know…

    __
    Insert Witty Banter

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