Skip to main content
Inspiring
March 13, 2013
Question

Change opacity precomp layer expression

  • March 13, 2013
  • 1 reply
  • 2749 views

Hi,

I want to control my precomp layers opacity within my maincomp by changing the layername.

For example: If my layer name(in the maincomp) is "A" only the layer called "A" in the precomp will show.

I allready wrote an expression:

if (comp("Main Comp").layer("A").name == ('A'))

{temp_opacity = 100};

else

{temp_opacity = 0};

temp_opacity

But the problem is, there need to be multiple precomps controlled in the main comp. And if both precomps are called "A" the script fails.

So maybe I need to have a control in the expression that will check which precomp it needs to use. (the sourse.layer.)

I'm trying the figgure it out last two weeks without succes, so if anyone can help me I'll be very thankfull!

JW

This topic has been closed for replies.

1 reply

Dan Ebberts
Community Expert
Community Expert
March 13, 2013

It sounds like you want different instances of the same precomp to behave differently depending on the layer name of the precomp. If that's the case, it won't work because precomps are rendered once, even if used multiple times.

Dan

Inspiring
March 13, 2013

Hi Dan,

Thanks for your quick respose! No there are multiple precomps with different names the only thing is that the need to be control in the same maincomp. I used true comp duplicator to copy the precomp.

Maybe you have an other solution for my scene, What I have is a comp with letters from A to Z all in seperate layers and I want to control which letter is visalble from my maincomp. But there need to be multiple letters in the main comp. The result is that I can make a word by changing the layernames in the maincomp. Hope you understand what I mean.

Hope you can help me with this:)

Inspiring
March 13, 2013

Even if the precomps are different, if you give them the same name the expressions will only use the first comp named "A" that they find. So you need to give them all different names.

Is this the issue?