Activity › Forums › Adobe After Effects Expressions › Creating Layer Hierarchy using Expression Layer Control
-
Creating Layer Hierarchy using Expression Layer Control
Posted by Roland R. kahlenberg on September 15, 2010 at 8:19 pmIs it possible to Create a Layer Hierarchy involving a lot of layers using Expression Layer Controls?
I was thinking of applying as many Expression Layer Controls as there are layers onto a Controller layer in a separate comp. Each layer will then assess its index based on their hierarchy within the stack of Expression Layer Controls.
This is best suited for a JSX but that’s beyond me. If a kind soul could write a JSX that reads from a *.txt file that contains a list of the layers’ names and then distributed these layers within the timeline based on their order within the *.txt then that would be very cool.
Cheers
RoRKSell your AEPs with broadcastGEMs’ DVD series of templates. Click here for more
Roland R. kahlenberg replied 15 years, 11 months ago 3 Members · 9 Replies -
9 Replies
-
Chris Wright
September 15, 2010 at 8:45 pmI think you could help people more by answering 3 questions
1. what is the end result you’re trying to do?
2. “distributed these layers within the timeline?” please detail.3. “hierarchy within the stack of Expression Layer Controls.” so there’s a list of effects on a layer that you want to re-sort?
https://technicolorsoftware.hostzi.com/
-
Dan Ebberts
September 15, 2010 at 8:54 pmHey Roland,
It sounds like you want the layers to move around in the layer stack based on the settings of the layer controls in the other comp, is that correct?
If so, there are a couple of problems. The main one is that expressions can’t move layers around. The other problem is that layer controls only let you specify layers that exist in the comp where the control is.
You’re correct in that you’d need a script for this. It sounds like a pretty simple script, but it’s not something you would knock out in a few minutes, like an expression.
Dan
-
Roland R. kahlenberg
September 15, 2010 at 9:14 pmHeya Dan and Chris, thanks for the replies.
Dan you’re right on all fronts. I knew I was clutching thin air, looking for an Expression solution.
Chris, here’s the background info –
The background info –
I have a few effects set up to kick in based on a layer’s index. There are over a hundred of these layers. These layers currently have Expressions and keyframes.I just need a quick way to create alternative permutations in terms of stacking the layers in the timeline (different indexing structure).
As a helper for myself, I have a visualizer layer where I’ve created solids to visually represent each layer’s location within compspace. I’ve also added Basic Text onto each solid and placed each layer’s name into the Basic Text source.
With the visualizer, I can easily see each layer’s location and name in the comp. I can easily type layernames into a text file, in desired stacking order. This is much easier than messing about through the layer stack within the timeline cos I’ve got close to two hundred layers and it’s important that the layers are stacked in a specific way so that the effects kick in in a desired manner.
So, something like
1) look at the list in the *.txt
2) check for alike named layers in the currently selected timeline/comp
3) stack layers according to the list in the *.txt
4) check to ensure that all layer names stated in the *.txt have been accounted for in the timeline/comp
5) quick report of results for step 4.
1. what is the end result you’re trying to do?
2. “distributed these layers within the timeline?” please detail.
Stacking layers within the timeline. I’ve got effects that are Expression-ed to kick in based on their index in the timeline.3. “hierarchy within the stack of Expression Layer Controls.” so there’s a list of effects on a layer that you want to re-sort?
Nope. Just to re-order the layers so that they have indexing based on my preferred order.
Hope that answers your Qs.
Thanks for reading.
RoRK
Sell your AEPs with broadcastGEMs’ DVD series of templates. Click here for more
-
Roland R. kahlenberg
September 16, 2010 at 4:02 amHeya Dan, I’m thinking of an alternative solution using sampleImage.
I have a Controller layer with y-rotation keyframes. I’d like precomped layers to follow these y-rotation keyframes but offset in time based on grayscale values of another layer, “Y-RotationMapper”.
The idea is sorta like a Compound Effect using sampleImage as the engine.Any idea what the Expression will looks like?
Cheers
RoRKAE templates for sale and rental. Click here for more
-
Dan Ebberts
September 16, 2010 at 9:02 pmGrayscale values from a particular location on the layer, or average the whole layer? If from a particular location, how is that controlled?
Dan
-
Roland R. kahlenberg
September 16, 2010 at 9:40 pmHi Dan, it’ll be grayscale info from a particular location. So, the affected layers will read grayscale data from “Layer Y-RotationMapper” at Layer A’s mid point (width/2,height/2).
I’ve checked the sampleImage syntax and it seems doable or at least worth a shot but I’m having difficulty using the sampleImage result to time offset an effect.
Again, there is a MainRotation layer with a bunch of Y-rotation keyframes. Then there are a bunch of layers, that should follow the Y-rotation values of the MainRotation layer but offset in time so that I get a cascading effect.
I’m looking at bright values starting the rotation first and then darker values later. It’s a wee bit like of Card Dance; that’s what I’m trying to mimic.
FWIW, the grayscale layer will be static as I foresee interesting effects if it were dynamic but I also envision possible chaos.
Cheers
RoRKAE templates for sale and rental. Click here for more
-
Dan Ebberts
September 16, 2010 at 10:30 pmRoland,
I think it’s going to look something like this:
minDelay = 0;
maxDelay = 1.0;
L1 = thisComp.layer("Layer Y-RotationMapper");
samp = L1.sampleImage([.5,.5],[L1.width,L1.height]/2,true,time);
hsl = rgbToHsl(samp);
delay = linear(hsl[2],0,1,maxDelay,minDelay);
L2 = thisComp.layer("MainRotation");
L2.transform.yRotation.valueAtTime(time - delay)
Dan
-
Roland R. kahlenberg
September 16, 2010 at 10:52 pmWOOT!!! Thanks Dan. I just set my computer for a render and it’s 6.50AM, so I’m gonna myself some much needed snooze. I’ll take the script for a spin as soon as I can tomorrow.
Cheers
RoRKAE templates for sale and rental. Click here for more
-
Roland R. kahlenberg
September 17, 2010 at 1:57 pmHeya Dan, after a bit of tinkering, I found that this works beautifully. I just wished it was faster. I may also need to finetune the second parameter for sampleImage.
This script is applied to Null Layers whose top left corner is centered against the actual layers that move. There is such a Null for each of the moving layers. So, I’m essentially trying to sample from the top left corner of each Null that has the Expression.
—————————
minDelay = 0;
maxDelay = 1.5;
L1 = thisComp.layer(“Layer Y-RotationMapper”);
samp = L1.sampleImage([transform.position[0],transform.position[1]],[1,5],true,time);
hsl = rgbToHsl(samp);
delay = linear(hsl[2],0,1,maxDelay,minDelay);
L2 = thisComp.layer(“Main Controller Layer”);
L2.transform.yRotation.valueAtTime(time-delay)
—————————-Having said all that, the results look really awesome. I’ll tidy up and add more eye candy. I’ll send you the AEP in due time. I think you’ll have fun looking at this.
Cheers
RoRKAE templates for sale and rental. Click here for more
Reply to this Discussion! Login or Sign Up