Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Change layer opacity once it reaches position

  • Change layer opacity once it reaches position

    Posted by Abbi Eiler on April 26, 2019 at 1:45 pm

    I am just starting the learning process for expressions and I’m at the level where I can usually find one that works for what I need and then tweak it accordingly ( unless it’s super complex). However, I still haven’t fully grasped how to effectively write expressions from scratch.

    I am creating a stream of particles individually with the help of expressions (because that’s how I got the control I needed) and now I would like to have each layer’s opacity fade out once it reaches a position. An expression to fade in and out at the in and outpoint didn’t work because each particle is reaching the end location at a different time. So, I need an expression that changes the opacity on layer A once it reaches a designated position. I may be overthinking it but thanks in advance!

    Abbi Eiler replied 7 years ago 2 Members · 3 Replies
  • 3 Replies
  • Kalleheikki Kannisto

    April 27, 2019 at 7:10 am

    Linear() is a good expression for such things. What it does is remaps an input range of a variable to an output range. So, you can give it the variable X (which can literally be the x coordinate of the layer, for instance) and tell which input range, say 1000 to 1500 you want to convert to what output range. Since opacity goes from 0 to 100 you can therefore convert it to 100 to 0 for an opacity fade. The resulting expression goes:

    linear(X, 1000, 1500, 100, 0)

    and would be applied to the opacity of the layer. Since X is not yet defined there, you would pick-whip it to the property you want, such as the x coordinate of the layer position. Or you could calculate the distance from a given point for the value of X with a bit of trigonometry.

    The input value range can be whatever you want so as to make it fade within the X range you want.

    Kalleheikki Kannisto
    Senior Graphic Designer

  • Kalleheikki Kannisto

    April 27, 2019 at 10:55 am

    If you prefer an expression-free solution, you can precomp all your particle layers and use a track matte with a gradient ramp to make them fade out where you want.

    Kalleheikki Kannisto
    Senior Graphic Designer

  • Abbi Eiler

    April 27, 2019 at 12:22 pm

    That is exactly what I need! Thank you! I thought linear would work but I was using it wrong. I was trying to do it based on time so it made it more complicated because I wasn’t converting the seconds to frames correctly.

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