Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Position change triggers opacity ramp-down event.

  • Position change triggers opacity ramp-down event.

    Posted by Waldemar Werbel on May 12, 2013 at 4:42 pm

    Hi all,

    I’d like to use an expression in a layer’s opacity parameter which looks for a change in the same layer’s position. When there is a change in position, I’d like the expression to ramp the layer’s opacity value down from 100 to 0 over 4 frames.

    The layer’s default opacity would be 0 – basically, the layer flashes on briefly every time its position changes. Here’s a .gif to illustrate how it would look in keyframes…

    Thanks in advance for any help you can offer!

    Waldemar Werbel replied 13 years, 3 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    May 12, 2013 at 5:27 pm

    I think this will work:


    p = transform.position;
    n = 0;
    if (p.numKeys > 0){
    n = p.nearestKey(time).index;
    if (p.key(n).time > time) n--;
    }
    if (n > 0){
    t = time - p.key(n).time;
    ease(t,0,framesToTime(4),100,0);
    }else{
    0
    }

    Dan

  • Waldemar Werbel

    May 12, 2013 at 5:33 pm

    Thanks Dan.

    That worked a treat.

    Very much obliged to you!

    Wal.

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