Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Fade In/Out Expression Problems

  • Fade In/Out Expression Problems

    Posted by Austin Duncan on May 15, 2014 at 6:31 pm

    Hi,
    I’m using an expression (provided by Roland R. Kahlenberg) to control a Pre-Composed group of layers. The expression he provided currently fades in the first layer over 5 seconds, and then offsets each subsequent layer by 3 seconds, and then fades in over 5 seconds as well. This expression works perfectly, but theres a couple of things more I was hoping to add to it.

    First, if possible, it would be incredible if after all the layers fade in, to wait 5 seconds and then fade out all layers at once over a period of 5 seconds.
    Second, to have the expression start at the In Point of each layer, and when the fade out happens, to create an Out Point for each layer in the Pre-Comp.

    Thanks

    duration = 5;
    offset = 3;
    indexScalar = offset*(index-1);
    linear(time,indexScalar,indexScalar+duration,0,100)

    George Goodman replied 12 years, 3 months ago 3 Members · 4 Replies
  • 4 Replies
  • George Goodman

    May 15, 2014 at 7:25 pm

    This should do it. Auto fade in at layer inpoint and auto fade out at outpoint. It’s going by frames though so multiply your frame rate by 5 for the “fadeTime” variable if you want 5 seconds. So if your frame rate is 30fps, change fade time to 150.

    fadeTime = 15;
    opacityMin = 0;
    opacityMax = 100;
    layerDuration = outPoint - inPoint;
    singleFrame = thisComp.frameDuration;

    animateIn = linear(time, inPoint, (inPoint + framesToTime(fadeTime)), opacityMin, opacityMax);
    animateOut = linear(time, (outPoint - framesToTime(fadeTime+1)), (outPoint-singleFrame), opacityMax, opacityMin);

    if(time < (layerDuration/2)){animateIn;}else{animateOut;}

    “|_ (°_0) _|”

    Sincerely,

    George

    http://www.vimeo.com/georgegoodman
    http://www.linkedin.com/in/georgefranklingoodman

  • Kevin Camp

    May 15, 2014 at 7:31 pm

    just to make sure i know what you’re asking…

    you want each layer to be 15 seconds with a 5 second fade-in, 5 seconds at 100% and then 5 seconds to fade out. you still want to keep the 3 second offset between layers and you’d like to have the fade start at the inpoint and the after the fade out to set an outpoint.

    first off, expressions can’t set in or out points, so if you go this route, you’ll need to use a different method to create the offset (animation>keyframe assistant>sequence layers can do this, so that’s not a big deal).

    so the first thing you’ll want to do is make all the layers the same length. if they currently all start at the first keyframe of the comp, simply select all the layers, go 15 seconds down the timeline and then hit alt-] or option-] (right-bracket key) to trim them all to the same length.

    then with the layers still selected, choose animation>keyframe assistant>sequence layers and choose the option for overlap and enter the duration of the overlap, which if i understand what you want would be 13 seconds. note that the order in which you select the layers determines the order that the layers will be sequenced, first layer selected will be first in the timeline.

    then for the opacity expression you want something like this:
    duration = 5;
    if (time>=inPoint && time

    Kevin Camp
    Art Director
    KCPQ, KZJO & KRCW

  • Austin Duncan

    May 16, 2014 at 12:35 am

    thank you SO much! That worked exactly like I wanting.
    Thanks!

    Austin Duncan
    Duncan. Artwork
    austinwayneduncan.com

  • George Goodman

    May 16, 2014 at 1:27 pm

    Realized I gave you bad advice, sorry. This would work much better.

    fadetime = 5

    animateIn = ease(time, inPoint, inPoint+fadetime, 0, 100);
    animateOut = ease(time, (outPoint - fadetime), outPoint, 100, 0);

    if (time <= inPoint+fadetime) {animateIn} else {animateOut}

    “|_ (°_0) _|”

    Sincerely,

    George

    http://www.vimeo.com/georgegoodman
    http://www.linkedin.com/in/georgefranklingoodman

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