Copy link to clipboard
Copied
I was looking at Motion Array's tutorial regarding this same task however there seems to be an issue that I can't figure out.
I have used the below code but the result I get is that the first layer does exactly what I need but any subsequent layer is offset positionally only half of the first (ie if the first layer is offset by a value of 270px, all other layers are only offset by 135px. To fix this I turn off every second layer but this seems like its not right.
Any insights would be very much appreciated.
m=index-4; d=thisComp.layer("Controller").effect("Delay")("Slider"); p=thisComp.layer("Text Box 1").transform.position.valueAtTime(time-d*m); ox=thisComp.layer("Controller").effect("X Offset")("Slider"); oy=thisComp.layer("Controller").effect("Y Offset")("Slider"); [p[0]+ox*m,p[1]+oy*m]
Copy link to clipboard
Copied
Enough time has to pass for the layer spacing to work out. Are you sure you are waiting long enough for all of the layers to catch up? If there are less than four layers above the Text Box 1 layer, you are going to have a duplicate layer behind and in the same position as the "TB1" layer.
Copy link to clipboard
Copied
Agree withg Rick. Probably a timing issue. Also keep in mind that due to using the index as a multiplier you have to strictly adhere to the layer order and can't just insert other stuff inbetween.
Mylenium
Copy link to clipboard
Copied
I replaced the slider controls with some arbitrary values and got this from your expression. I also changed the index minus from minus four to minus one so the expression looked at the layer above so all layers would move. I got this:
The expression works exactly as expected. A half second after the first layer starts to move, then the second one moves, and the spacing between the layers is adjust to the defined values.
Copy link to clipboard
Copied
Thanks Rick and Mylenium. It wasn't a timing issue.
And although I got Rick's revised code to work perfectly once I added the sliders into the mix (important to me for flexibility) I was getting the same problem.
Then I moved the adjustment layer to the bottom of the comp the code worked perfectly (adjusted to include the sliders). Then I retired Motion Array's version of the code with sliders layer at the bottom and it worked as well.
So basically still not sure why it wasn't working originally but now I have two bits of code to do the same thing.
Thanks Rick.
Copy link to clipboard
Copied
Using only the layer's Index fouls up the layer position when you move a layer above or below the first offset shape layer to zero out the count so the offset is correct, if the First Shape layer that is following the animated text layer is named Text Box 1, then this expression will solve the offset layers problem you are having.
m= index - thisComp.layer("Text Box 1").index;
d=thisComp.layer("Controller").effect("Delay")("Slider");
p=thisComp.layer("Text Box 1").transform.position.valueAtTime(time-d*m);
ox=thisComp.layer("Controller").effect("X Offset")("Slider");
oy=thisComp.layer("Controller").effect("Y Offset")("Slider");
[p[0]+ox*m,p[1]+oy*m]
Here's another suggestion. Adjustment layers are not made for Expression Controls. Adjustment Layers are meant to apply effects to all layers below them. Using a Null is a better idea if you only want to add Expression Controls. When troubleshooting a comp, seeing the Adjustment Layer button turned on makes you think that the layer contains effects.
If my comp requires multiple Expression Controls (Slider, Rotation, Position, etc.) I usually put them on Layer 1 or directly above a group of layers that refer to the controls. I never put them on an Adjustment layer unless the adjustment layer has effects that refer to the controllers.
Copy link to clipboard
Copied
Thanks Rick,
I appreciate your time and explanation on this one.