• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to use checkbox to decide layers order

Community Beginner ,
Nov 12, 2022 Nov 12, 2022

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.  

TOPICS
Expressions , Scripting

Views

174

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 13, 2022 Nov 13, 2022

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 13, 2022 Nov 13, 2022

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

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 07, 2022 Dec 07, 2022

Copy link to clipboard

Copied

LATEST

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. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines