Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Opacity fade in and out with marks

  • Dan Ebberts

    March 12, 2013 at 6:30 pm

    Something like this maybe:


    fadeTime = .5;
    if (marker.numKeys > 1){
    t1 = marker.key(1).time;
    t2 = marker.key(2).time;
    if (time < (t1+t2)/2)
    ease(time,t1,t1+fadeTime,0,100)
    else
    ease(time,t2-fadeTime,t2,100,0);
    }else
    value

    Dan

  • Marcelo Cabral

    March 12, 2013 at 7:15 pm

    Thank you Dan!! it works awesome. That was I was looking for. Best regards.

  • Dan Ebberts

    March 12, 2013 at 7:25 pm

    edit: oops responding to wrong post.

    Dan

  • Marcelo Cabral

    March 12, 2013 at 7:49 pm

    Hi Dan, me again.
    I have this expression to move in and out of the scene a text layer. It works fine but It would be even better with a ease in and ease out controls. Is this posible? Thanks in advance.

    m = 450;
    if (marker.numKeys > 0 && time <= marker.key(1).time){ value + [1,0]*(time-inPoint)*m; } if (marker.numKeys > 0 && time >= marker.key(1).time){
    value + [1,0]*(marker.key(1).time-inPoint)*m + [0,0]*(time-marker.key(1).time)*m;
    }
    if (marker.numKeys > 1 && time >= marker.key(2).time){
    value + [1,0]*(marker.key(1).time-inPoint)*m + [0,0]*(marker.key(2).time-marker.key(1).time)*m + [1,0]*(time-marker.key(2).time)*m;
    }

  • Mitch Mann

    March 12, 2013 at 8:53 pm

    Cool, I didn’t know you could do Eval’s in expressions, I’m going to try that. Thanks Dan!

  • Dan Ebberts

    March 12, 2013 at 9:30 pm

    Hmmm… I think to do that the expression needs to be able to calculate the distance traveled over a specific interval, and then use ease(), easeIn(), or easeOut(), as appropriate. The way you have it set up, the expression could calculate the distance of the travel up to the first marker, but there’s no fixed distance traveled (or fixed interval) after the second marker–it just keeps going. Maybe with 3 markers…

    Dan

  • Juanluis Vich

    May 18, 2017 at 5:32 pm

    hi!
    on your expression:


    fadeTime = .5;
    if (marker.numKeys > 1){
    t1 = marker.key(1).time;
    t2 = marker.key(2).time;
    if (time < (t1+t2)/2)
    ease(time,t1,t1+fadeTime,0,100)
    else
    ease(time,t2-fadeTime,t2,100,0);
    }else
    value

    what if we add another “in” marker in the layer later in the timeline?
    how it could be modified to have it fading in again? (so basically each time it reaches the “in” it fades in and “out” it fades out, not only the first time

    thanks!

  • Dan Ebberts

    May 18, 2017 at 5:58 pm

    Something like this might work:


    fadeTime = .5;
    if (marker.numKeys > 0){
    n = marker.nearestKey(time).index;
    if (time < marker.key(n).time) n--;
    if (n > 0){
    t0 = marker.key(n).time;
    if (n%2)
    ease(time,t0,t0+fadeTime,0,100)
    else
    ease(time,t0,t0+fadeTime,100,0);
    }else{
    0
    }
    }else
    value

    Dan

  • Juanluis Vich

    May 18, 2017 at 7:17 pm

    awesome!!!

    this way every marker will trigger the in and out fading, right? I don’t know if it is possible to make it work only if the comment “in” or “out” appears? to prevent any unwanted in/out, I mean…

  • Dan Ebberts

    May 18, 2017 at 7:50 pm

    That’s trickier, especially if it’s possible that the expression could run into a marker that doesn’t have “in” or “out”. It would have to loop back through previous markers to figure out what state it should be in currently.

    Dan

Page 1 of 2

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