Precompose shape layer with linked expressions
Copy link to clipboard
Copied
Hello!
I am learning about expressions and have created an offsetted chain of shape layers that is linked to a sinwave expression. I am curious what the best method to update the shape layers with new sources would be? I have tried precomposing the shape layer and copying the expressions back after they've moved into the precomp but that doesn't seem to work. Any thoughts on this?
Thanks!
Copy link to clipboard
Copied
You can replace thisComp with comp('Example 4 Position + Rotation')
and then you'll be able to move your layers anywhere.
Copy link to clipboard
Copied
Thanks for getting back AirWeb_AE
Can you explain what that function is doing? -- Essentially I just want to swap each shape layer (with expressions) with a new layer (precomp) - which I suppose I can do by hand matching each new source's PositionScaleRotation to each shape and parenting it to the shape layers with expressions. But I was hoping there's a more parametric method.
Copy link to clipboard
Copied
In After Effects, thisComp refers to the composition in which the expression is located. In your case:
thisComp = comp("Example 4 Position + Rotation")
If you pre-compose your shape layer, thisComp will refer to the name of your new pre-composition.
Therefore:
thisComp.layer("Controls")
will generate an error because "Controls" layer isn't in your new pre-composition, it's in the "Example 4 Position + Rotation" composition.
That’s why you need to use comp("Example 4 Position + Rotation").
If you don't want to replace thisComp, you simply need to move or duplicate your "Controls" layer into your new composition.

