Variable Expression Control across Multiple Layers
My current setup:
So I have a scene that contains a camera and a large amount of precomps dispersed in 3d space. I am also using a technique that utilizes beams to create a 3d connection from these precomps to a central point in the scene. This is the expression commonly used.
Since I have hundreds of layers of beams, I created a null with several expression controls, linked to beam effect properties (ie. Length, Time, Softness, etc.) for master control of all of these layers.
Since I'm using to 2d Beam effect to simulate 3d connections, I have to use this handy expression from Darby Edelen seen here https://forums.creativecow.net/thread/2/945108 in order to create the appearance of perspective on the Beam starting and ending thickness. The expression looks like:
Furthermore, since all of my beam layers have the starting thickness and ending thickness properties connected to a starting thickness master slider and an ending thickness master slider, (both of which are located in my master control null layer) I cannot apply the above expression since it is layer name specific.
The problem is with the layer referencing portion of the expression.
Now to my question:
Is there a way that I can write the expression so that the incoming connection from a beam layer will maintain its reference for the layer name specific portion of the expression?
Right now it's looking like I'll have to manually apply the perspective beam expression to each beam layer and update the ("layer name") manually.
Any help would be much appreciated.
the answer to the question of how to tell darby's expression to reference a specific layer, would be to use the same method of referencing the layer in your first expression. if you typed in a layer name for each beam effect end point to reference an specific layer, then you'll need to do the same for darby's expression.
you can specify a layer by index rather than name, so you could use the index of the layer with the expression to specify a layer that is relative to it's index... ex: you could specify to use the layer bellow the expression layer with an expression like this:
layerBellow = thisComp.layer(index+1);
layerAbove = thisComp.layer(index-1);
but that may mean that you need to restructure your current comp, so i don't know if that helps you out much.
or you could use a layer control (in the expression controls effects)on the beam layers to pick a specific layer, and link both expression the end point expression and the thickness expression to that control. the expression would look something like this:
selectedLayer = effect("Layer Control")("Layer");
but again, this requires some reworking of what you have.
regardless of how you choose the layer, there is a change that you need to make in darby's expression so that it will reference the thickness value of your slider.
you need to add a variable to point at the value of the slider and then replace 'value' in the last line to the name of the variable. it could look something like this:
endThickness = thisComp.layer('Control').efect('Slider Control')('Slider');
// last line
endThickness * cam.zoom / d;
KCPQ, KZJO & KRCW