ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Controlling layers with identical animation but scattered over timeline

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Eddie Bogdanov
Controlling layers with identical animation but scattered over timeline
on Jun 19, 2012 at 4:24:42 pm

Hello.

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


Return to posts index

Dan Ebberts
Re: Controlling layers with identical animation but scattered over timeline
on Jun 19, 2012 at 4:49:51 pm

You 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 - v0


Dan



Return to posts index

Eddie Bogdanov
Re: Controlling layers with identical animation but scattered over timeline
on Jun 19, 2012 at 6:36:49 pm

Wow, it worked perfectly. You are saving me so much time... thanks man!

What changes do I make so it would work for opacity too?


Return to posts index


Dan Ebberts
Re: Controlling layers with identical animation but scattered over timeline
on Jun 19, 2012 at 6:41:44 pm

Wherever you see "position", change it to "opacity". :-)

dan



Return to posts index

Eddie Bogdanov
Re: Controlling layers with identical animation but scattered over timeline
on Jun 19, 2012 at 6:59:40 pm

Yes, 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 :)


Return to posts index

JuanLuis Vich
Re: Controlling layers with identical animation but scattered over timeline
on Jan 28, 2017 at 1:31:43 am

that'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!


Return to posts index


Dan Ebberts
Re: Controlling layers with identical animation but scattered over timeline
on Jan 28, 2017 at 1:57:40 am

This 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



Return to posts index

JuanLuis Vich
Re: Controlling layers with identical animation but scattered over timeline
on Jan 28, 2017 at 2:14:37 am

awesome! thanks!!


Return to posts index

Peter Zeet
Re: Controlling layers with identical animation but scattered over timeline
on Feb 1, 2019 at 3:55:28 pm

hi!
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!


Return to posts index


Nate Vander Plas
Re: Controlling layers with identical animation but scattered over timeline
on Feb 5, 2019 at 4:00:38 pm

Try 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 &lt; (inPoint+outPoint)/2)
valueAtTime(key(1).time+time-inPoint)
else
valueAtTime(key(numKeys).time-(outPoint-time));




Return to posts index

Nate Vander Plas
Re: Controlling layers with identical animation but scattered over timeline
on Feb 5, 2019 at 4:22:35 pm

In case you need the layers' outPoints to have keyframes, here's an updated project file that shows this functionality:
13087_keyframesatinpointexpressionv2.aep.zip



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]