Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Global variables

  • Posted by Mariola Moreno on January 26, 2010 at 3:52 pm

    Hello to all. I’m new in the expressions world and I don’t know speak english very well, so… sorry in advnace.

    I need to know how to declare global variables in a composition, so I needn’t declare this variables in each layers again.

    I send a example code. I want to call this variables (opacidad1, opacidad2,opacidad3, opacidad4, opacidad5) from any layer without declare them again.

    Is this posible?

    Thanks

    opacidad1=transform.opacity;
    opacidad2=thisComp.layer("PASTILLA 2").transform.opacity;
    opacidad3=thisComp.layer("PASTILLA 3").transform.opacity;
    opacidad4=thisComp.layer("PASTILLA 4").transform.opacity;
    opacidad5=thisComp.layer("PASTILLA 5").transform.opacity;

    if((opacidad1==100) && (opacidad2==100)&& (opacidad3==100)&& (opacidad4==100)&& (opacidad5==100)){
    temp=100;
    }

    Mariola Moreno replied 16 years, 3 months ago 3 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    January 26, 2010 at 6:04 pm

    Expressions can’t change anything except the value of the property to which they are applied. So there aren’t any global variables. You can set up read-only “variables” by applying expressions to slider controls and having all your other expressions reference those, but that doesn’t save you much compared to declaring them as you have done in your example.

    Dan

  • Mariola Moreno

    January 27, 2010 at 12:55 pm

    Thanks for your answer.

    So there is no way to keep any value in one variable separately. For example… I want to have a variable wich contains the opacity value of de LAYER 1. I’m going to use this variable in my other 100 layers.

    So, Have I to declare this variable in each 100 layers?

    Sorry for lower Knowledge about expressions…

    Thank you very much

  • Ryan Hill

    January 27, 2010 at 9:06 pm

    Well, to expand on what Dan said, you can make a slider and then pick-whip your variable to that slider.

    This’ll result in a longer piece of text in the expression, which you’ll still need to put in all of the expressions, but it means if you later decide, “Oh, I want to see what happens if this is 5 instead of 4,” you only need to change the slider.

  • Mariola Moreno

    January 28, 2010 at 9:29 am

    Thanks for your help

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy