FORUMS: list search recent posts

# Auto fade in/out layers BUT with a defined blinking effect

FAQ   •   VIEW ALL
 Auto fade in/out layers BUT with a defined blinking effect on Jul 3, 2017 at 7:10:27 pm

Hello! Thanks for taking the time to look at my query.

At present, Im keyframing layers flickering on by keyframing the opacity like so:
frame 1 - 0%
frame 2 - 25%
frame 3 - 0%
frame 4 - 50%
frame 5- 0%
frame 6 - 75%
frame 7 - 0%
frame 8 -100%
I then do the reverse to flicker the layer off. Now i'm doing this to LOTS of layers of varying length and adjusting the timing by moving the keyframes is getting tedious. I'm familiar with an expression that auto fades on/off a layer's opacity based it's inPoint and outPoint:

fadeInTime = .5;
fadeOutTime = .5;
Math.min(linear(time,inPoint,inPoint + fadeInTime,0,100),linear(time,outPoint - fadeOutTime,outPoint,100,0))

But i'm wondering if theres a way to adapt this so that i get the exact result as the keyframes above, but without keyframes so that 8 frame animation happens at the inPoint and outPoint of the layer so when i want to change when the layer animates in/out, i just have to extend/clip the layer length/move it along the timeline.

Any advice would be much appreciated.

Thanks v much guys ☺

Tom

 Return to posts index

 Re: Auto fade in/out layers BUT with a defined blinking effecton Jul 3, 2017 at 8:14:50 pm

This should be close:

``` if (time < inPoint || time > outPoint){ f = 0; }else if (time < inPoint+outPoint/2){ f = timeToFrames(time - inPoint); }else{ f = timeToFrames(outPoint - time); } switch(f){ case 0: case 2: case 4: case 6: 0; break; case 1: 25; break; case 3: 50; break; case 5: 75; break; case 7: 100; break; default: 100; break; } ```

Dan

 Return to posts index

 Re: Auto fade in/out layers BUT with a defined blinking effecton Jul 3, 2017 at 9:37:48 pm

Dan you're a frikkin genius. You've solved it yet again.

I understand the top half but If you've got a sec, could you briefly explain whats happening from 'switch(f){' onwards? What is switch, break and case?

Thank you!

Tom

 Return to posts index

 Re: Auto fade in/out layers BUT with a defined blinking effecton Jul 3, 2017 at 9:39:54 pm

This explains it better than I could:

https://www.w3schools.com/js/js_switch.asp

Dan

 Return to posts index

 Re: Auto fade in/out layers BUT with a defined blinking effecton Jul 3, 2017 at 9:48:23 pm

i'll have a browse thanks ☺

On further play, It's behaving a little odd. I've duplicated the text and adjusted the length and some of them work as expected and some just cut straight off... if i extend the time of the ones that cut off to a longer then they do the flicker... its seems random as to if they work or not.

Thanks

Tom

 Return to posts index

 Re: Auto fade in/out layers BUT with a defined blinking effecton Jul 3, 2017 at 10:21:00 pm

Sorry--rookie mistake. Try this one:

``` if (time < inPoint || time > outPoint){ f = 0; }else if (time < (inPoint+outPoint)/2){ f = timeToFrames(time - inPoint); }else{ f = timeToFrames(outPoint - time); } switch(f){ case 0: case 2: case 4: case 6: 0; break; case 1: 25; break; case 3: 50; break; case 5: 75; break; case 7: 100; break; default: 100; break; } ```

Dan

 Return to posts index

 Re: Auto fade in/out layers BUT with a defined blinking effecton Jul 4, 2017 at 8:36:45 am

amazing that seem to have got it, thank you!

As if you haven't help me enough, i'd like to try push it a little:

Could this be adapted so that it could be applied to text's 'animator' property so each letter or word (you can choose) would flicker on in sequence or randomly (also choose). Ideally Id like to have a text layer that animates on/off based on the inPoint and outPoint (as it does so beautifully now) except there for would expression controls that allow you to change weather it flickers on as a whole, per word or per letter and also weather each word/letter flickers on in sequence or randomly.

Would this be terribly complicated?

Thanks again for your help Dan, really appreciated.

Tom

 Return to posts index

 Re: Auto fade in/out layers BUT with a defined blinking effecton Sep 3, 2017 at 11:26:43 am

Hi Dan, i just wanted to share with you the project I just completed that used you expression. You saved me so much time, thank you:

desktop:

mobile:
https://www.reddit.com/r/AfterEffects/comments/6xpsy9/check_out_the_lyric_v...

 Return to posts index

© 2018 CreativeCOW.net All Rights Reserved
[TOP]