by Jeff Horowitz on May 20, 2014 at 5:23:47 pm

So I have two layers:
Layer 1: text
Layer 2: shape layer(text box)

On Layer 2 I've added this expression to its opacity to tell the text box to disappear in the event that there is no text:

thisComp.layer(1).text.sourceText.length>0?75:0

I also want to add this expression to Layer 2 to tell the text box to fade in and out:

HOW CAN I USE BOTH EXPRESSIONS ON THE OPACITY OF THE SAME LAYER, SO I CAN HAVE THE TEXT BOX FADE IN AND OUT AND ALSO NOT APPEAR WHEN THERE'S NO TEXT?

JAH

Re: Fade In/Out & Opacity Expression
by Dan Ebberts on May 20, 2014 at 5:37:10 pm

Something like this should work:

``` fadeInTime = .5; fadeOutTime = .5; if (thisComp.layer(1).text.sourceText.length>0){ if (time < (inPoint+outPoint)/2) linear(time,inPoint,inPoint+fadeInTime,0,75) else linear(time,outPoint-fadeOutTime,outPoint,75,0); }else 0 ```

Dan

Re: Fade In/Out & Opacity Expression
by Jeff Horowitz on May 20, 2014 at 5:47:40 pm

I'll see if this works and I'll let you know. Thanks for responding so fast.

JAH

Re: Fade In/Out & Opacity Expression
by Jeff Horowitz on May 20, 2014 at 7:09:15 pm

It worked perfectly, thanks again!

JAH

Re: Fade In/Out & Opacity Expression
by Jason Valalik on Aug 26, 2014 at 9:38:21 pm

How can I loop this? I get the fade in and out, but I want it to loop on and off throughout.

Re: Fade In/Out & Opacity Expression
by Dan Ebberts on Aug 26, 2014 at 11:19:43 pm

Something like this maybe:

``` fadeInTime = .5; fadeOutTime = .5; minVal = 0; maxVal = 75; if (thisComp.layer(1).text.sourceText.length>0){ t = (time-inPoint)%(fadeInTime+fadeOutTime); if (t < fadeInTime) ease(t,0,fadeInTime,minVal,maxVal) else ease(t,fadeInTime,fadeInTime+fadeOutTime,maxVal,minVal); }else 0 ```

Dan

Re: Fade In/Out & Opacity Expression
by Jason Valalik on Aug 26, 2014 at 11:23:43 pm

yep! That totally worked. Thanks

What about if I wanted to show something like this.

When it fades out have a new piece of text come in. So the user story would be that a customers airplane Gate Changed from say B5 to D10 and I want to have it flash/fade back in forth between the new and old gate?

thanks