Activity › Forums › Adobe After Effects Expressions › Controlling layers with identical animation but scattered over timeline
-
Controlling layers with identical animation but scattered over timeline
Posted by Eddie Bogdanov on June 19, 2012 at 4:24 pmHello.
I’m in a situation where I have around 700 layers and all of them have identical animation – a small position and opacity change. The problem is that they are on different places on timeline and it’s a pain if I want to change the keyframe values/length.
Maybe there is some smart way to make the control of the animation easier, with sliders perhaps?The easiest way for me at the moment is rearranging all of them to 0:00 second mark / deleting keyframes and creating new ones, then scatter them using a script but it takes a while and is pretty heavy on resources.
Thanks
Nate Vander plas replied 7 years, 2 months ago 5 Members · 10 Replies -
10 Replies
-
Dan Ebberts
June 19, 2012 at 4:49 pmYou could use sliders, but then you need to be able to define the animation in terms of a formula (sometimes easy, sometimes not).
Or, you could designate a keyframed layer as the leader and have the others reference that one. That way you’d only have to update one. A position expression to track the leader’s changes since its in point would look like this:
t = time-inPoint;
L = thisComp.layer(“leader”);
v0 = L.transform.position.valueAtTime(L.inPoint);
v1 = L.transform.position.valueAtTime(L.inPoint+t);
value + v1 – v0Dan
-
Eddie Bogdanov
June 19, 2012 at 6:36 pmWow, it worked perfectly. You are saving me so much time… thanks man!
What changes do I make so it would work for opacity too?
-
Eddie Bogdanov
June 19, 2012 at 6:59 pmYes, I tried that at first and it didn’t work. Played around and figured that before applying the expression, opacity must be the same value as the first keyframe of “leader”… in my case – 0%.
Thanks again! You are a great man 🙂
-
Juanluis Vich
January 28, 2017 at 1:31 amthat’s a great piece of code!
I’m wondering, how could it be adapted to make a marker the trigger instead of the inPoint? So I can have a layer with a solid standing there and when the timeline reaches the marker the animation starts.thanks!
-
Dan Ebberts
January 28, 2017 at 1:57 amThis would be one way:
if (marker.numKeys > 0){
t = Math.max(time - marker.key(1).time,0);
}else{
t = 0;
}
L = thisComp.layer("leader");
v0 = L.transform.position.valueAtTime(L.inPoint);
v1 = L.transform.position.valueAtTime(L.inPoint+t);
value + v1 - v0
Dan
-
Peter Zeet
February 1, 2019 at 3:55 pmhi!
sorry to bring this old post up
I’m trying to figure out how to adapt the expression to work with scale, so the layers can keep they relative scale, but no luck at all…So if a layer has a scale 75%, and the leader layer goes from 0 to 90, the follower layer goes to 75% as it maximum scale, and not to 90, or 90+value, etc
Maybe adding a linear() may work? or adding some scaleFactor? I thought it would be a quick one, but I’m a bit slow today
thanks!
-
Nate Vander plas
February 5, 2019 at 4:00 pmTry this expression on all your layers. It basically places keyframes at the inPoint and outPoint of your layer, so you can adjust the keyframes of all your layers at once (or individually) at the very beginning of the comp, and this expression will move them to the inPoint of the layer. See this project file: 13086_keyframesatinpointexpressionv1.aep.zip
if (time < (inPoint+outPoint)/2)
valueAtTime(key(1).time+time-inPoint)
else
valueAtTime(key(numKeys).time-(outPoint-time));
-
Nate Vander plas
February 5, 2019 at 4:22 pmIn case you need the layers’ outPoints to have keyframes, here’s an updated project file that shows this functionality:
13087_keyframesatinpointexpressionv2.aep.zip
Reply to this Discussion! Login or Sign Up