4 Replies Latest reply on Dec 2, 2009 3:20 PM by Andy Bay

    Simple expression maths question

    Andy Bay Level 2



      I really regret skipping so many math lessons in highschool, because with AE using math is actually fun and usefull :S


      The thing is quite simple:


      I have two layers, let's call them 1 & 2.


      Layer 1 needs to take it's opacity animation from Layer two. So far so easy, just use the expression pickwhip.


      But here's where the issue is that my slow brains can't seem to figure out:


      The starting opacity of Layer 2 is not 100% but instead 40%. However, for layer 2 the starting opacity is 100%. If I simply pickwhip the opacity, then layer 1 is going to jump it's opacity to 40% which is not good. So I tried an if/else statement like this for layer 1:


      opa=thisComp.layer("Shape Layer 1").transform.opacity+60 //adding 60 to make the opacity of layer 1 start correctly at 100


      if (opa<100) opa else (value) //tell layer 1 to follow the opacity of Layer 2 only when it starts dropping below 100


      However, this of course results in the opacity of layer 1 stopping at 40%.


      I know the solution to this must be embarrasingly simple. But how on earth do I make the Layer 1 start at 100% opacity and drop to 0% opacity when the Layer 2 which is the master layer is starting at 40% and ending to 0%?


      Most of all I would like to know how I should approach this correctly, like what is the mathematical way to solve this simple equation? You know the saying about teaching a man to fish right?