Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Increasing and decreasing opacity based on growing number from 0-1

  • Increasing and decreasing opacity based on growing number from 0-1

    Posted by John Toi on July 18, 2010 at 8:02 am

    Hi!

    I have an expression on the opacity of a solid.
    Here is the expression I have so far:

    life = 5;
    offset = 0;
    SeedRandom(index,true); 
    pause = random(life+offset);
    if(time < pause)
    age = 0;
    else
    age = (time-pause) % life;

    The variable \”age\” pauses at 0, increases, resets back to 0 when it reaches 1 and repeats the same thing again.
    I\’m trying to increace the opacity from 0-100 as age inceases from 0-0.2 and for the opacity to decrease back from 100-0 from 0.8-1 (1 and 0 are the same as it loops back with the % sign)
    Is this possibe and if so, how?

    Thanks in advance!

    John Toi replied 16 years, 1 month ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    July 18, 2010 at 7:19 pm

    This might be what you want:


    life = 5;
    offset = 0;
    seedRandom(index,true);
    pause = random(life+offset);
    if(time < pause)
    age = 0;
    else
    age = (time-pause) % life;

    if (age < .2)
    linear(age,0,.2,0,100)
    else
    linear(age,.8,1,100,0)

    Dan

  • John Toi

    July 19, 2010 at 1:33 pm

    Amazing! Thanks for the quick response!

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