Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Opacity jumps to a higher starting point than defined in the linear() expression

  • Opacity jumps to a higher starting point than defined in the linear() expression

  • Hauke Sterner

    March 6, 2023 at 4:20 pm

    Hello all!

    I’m fairly new to expressions and I have a problem with the following:
    L is a static circle that just fades in.
    M is the same circle, but it moves across the composition (only x-position).
    L is supposed to fade in once M hits the x-position of L.

    This is my expression:

    L = thisComp.layer(“Punkt”);
    M = thisComp.layer(“Punkt_Maske”);

    if (M.transform.position[0] >= L.transform.position[0]) {
    L.transform.opacity = linear(time, 0, 33);
    } else {
    0;
    }

    This expression kind of works, but the opacity of L does not start at 0 like stated in linear(), but jumps to a higher percentage and continues to 33%.

    Can somebody tell me what I’m doing wrong?

    Thanks! 🙂

  • Dan Ebberts

    March 6, 2023 at 4:54 pm

    Your expression needs to calculate how long ago the trigger event happened. Also, you didn’t mention how long the fade in should take, so I just set it to .5 seconds:

    L = thisComp.layer("Punkt");
    M = thisComp.layer("Punkt_Maske");
    fadeDur = .5;
    if (M.transform.position[0] >= L.transform.position[0]) {
    t = time - thisComp.frameDuration;
    while (M.transform.position.valueAtTime(t)[0] >= L.transform.position[0]){
    t -= thisComp.frameDuration;
    }
    linear(time-t,0,fadeDur,0,33);
    } else {
    0;
    }
  • Hauke Sterner

    March 7, 2023 at 6:59 am

    Hi Dan,

    thank you very much! It works like a charm! 🙂

Viewing 1 - 3 of 3 posts

Log in to reply.

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