Copy link to clipboard
Copied
I am trying to create a reusable composition with three layers in it. I would like to have a checkbox in Essential Graphics to decide if the layers are ordered 1, 2, 3 or 3, 2, 1. I have found the following script
to order layers but to which property can I connect this code?
Because it's not position, opacity nor rotation. Or is there some way to run code automatically when a composition is created or initialized?
All help appreciated, thank you.
Copy link to clipboard
Copied
Scripts cannot be used for expressions. They are completely different things. Neither can expressions actually reorder anything. Any such thing would have to be done with effects like e.g. CC Simple Composite that can fetch other layers and have controls to toggle the blending to create the illusion of layers being reordered. Anyway, it's not realyl clear what you are even trying to achieve so you need to provide more info and explain better.
Mylenium
Copy link to clipboard
Copied
The only thing you could do would be to duplicate layers 1 and 3 and set up an expression checkbox to switch the layers' opacity.
Layer order:
1
3b
2
3
1b
Add the checkbox control to layer 1, then use these expressions:
//layer 1
t = effect("Checkbox Control")("Checkbox");
if (t == 0)
100
else
0
// Layer 3
t = thisComp.layer("1").effect("Checkbox Control")("Checkbox");
if (t == 0)
100
else
0
// layer 1b and Laayer 3b
t = thisComp.layer("1").effect("Checkbox Control")("Checkbox");
if (t == 0)
0
else
100
Copy link to clipboard
Copied
Thanks for this input, I find it interesting, I ended up just creating two different Compositions since I also realized that Essential Graphics can only be used to pass variables down to the composition below and not pass it down any further. So the point of all this was to create a Finger composition and then reuse it several times and have the possibility of ordering which finger is on top etc. And then create a Hand with the fingerst and use it for both hands and only tweak some variables. Then in the Body use both hands and control them. But this seems to be quite difficult to design for reusability because of how Essential Graphics limits nesting variables down to more than one level below.