Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Opacity decay over time?

  • Opacity decay over time?

    Posted by Phil Aupperle on April 15, 2016 at 9:08 pm

    I’ve been trying to write an expression that will cause the opacity of a layer to decay to zero over time after any keyframe. The idea is to make a flashing effect on a layer that can be controlled just by a series of keyframes for max opacity values. I originally set out to have it ramp up as well, but that was even farther beyond my expression abilities. This is what I’ve been working with, but I’m stuck. Any ideas?

    It seems like it could be an interesting effect on any number of parameters.

    Thanks!

    decay = 1.0;
    n = 0;
    if (numKeys > 0){
    n = nearestKey(time).index;
    if (key(n).time > time){
    n--;
    }}
    if (n == 0){ t = 0;
    }else{
    t = time - key(n).time;
    }
    if (n > 0 && t < 1){
    P = (key(n).time - thisComp.frameDuration/10);
    value - P/Math.exp(decay*t);
    }else{value}

    Phil Aupperle replied 10 years, 3 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    April 15, 2016 at 10:09 pm

    Maybe something like this would help:


    if (numKeys > 0){
    n = nearestKey(time).index;
    rampUpTime = .1;
    rampDownTime = .2;
    if (time < key(n).time)
    ease(time,key(n).time-rampUpTime,key(n).time,0,value)
    else
    ease(time,key(n).time,key(n).time+rampDownTime,value,0);
    }else
    value

    Dan

  • Phil Aupperle

    April 15, 2016 at 11:01 pm

    Oh wow–way better strategy!

    Thank you again, Sensei.

    I have this wired up to some sliders and it is working great!

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