-
Follow the leader, with some springy/elastic motion…
Hi there. I’m fairly new to expressions, so, apologies in advance for my naivety.
What I’m trying to do is have five boxes move around the screen. The first (the leader of the pack) will be key framed, then I want the remaining four (the followers) to follow the leader, on a delay. Additionally, as if they’re connected by an invisible rubber band, I’d like the motion of the followers to have some elasticity when the leader starts and stops abruptly.
I copied the script below from an AE expression template called “follow”, and applied it to the followers’ position. So, now they follow, but do not have the springiness I’m after:
delay = effect(“Follow”)(“Delay”);
include = effect(“Follow”)(“Position”);
basedOnIndex = effect(“Follow”)(“Based On Index”);if (include == 1){
try{
L = effect(“Follow”)(“Leader”);
if (basedOnIndex == 1){
delta = Math.abs(L.index – index)*delay;
}else{
delta = delay;
}
L.toWorld(L.anchorPoint,time – delta)
}catch(err){
value
}
}else{
value
}I’ve poked around both in the AE expression templates, and on motionscript.com a bit, but can’t figure out how to get reactions based on abrupt movements of the leader. Most of the expression I’ve seen for springy/elastic motion seems to be based on Math.sine or some pattern, rather than referencing the motion of another element in the comp.
Sorry for the long-winded post. Any help is greatly appreciated. Thanks!