Activity › Forums › Adobe After Effects Expressions › Dan Ebberts ‘Follow the leader’
-
Dan Ebberts ‘Follow the leader’
Posted by Kieren Smith on February 11, 2013 at 11:12 pmHey all (mainly Dan),
I jumped on the popular site : https://www.motionscript.com/mastering-expressions/follow-the-leader.html and I’ve tried to work out how to do the ‘Follow the leader’ expression.
I just really cannot seem to get it working out. Trailers not orienting, and going at different rates… they aren’t 3D layers. just 2D but I really cannot seem to get a trail going.
I’ve posted the AE file here: 5429_fbv2v1.0followtheleadercopycs5.5.aep.zip
Please can someone check to see what I’ve done wrong so I can continue on with my project?
Thank you in advance
Kieren.__
Insert Witty BanterKieren Smith replied 13 years, 4 months ago 2 Members · 7 Replies -
7 Replies
-
Dan Ebberts
February 11, 2013 at 11:41 pmWith 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 amHey 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 amTry 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 amYOU, 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.zipWhen 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 am7 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 amDan, 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 amHi 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
Reply to this Discussion! Login or Sign Up