Looping opacity with set fade up/down and "stay on" durations
I've been scouring this site (and others) for over an hour now trying to find a way to fade a layer up over a set time, stay on for a set time, then fade down over the same fade up time, then loop. I can get the fade up, stay on, fade down bit--but falling down at adding the loop. I've found several examples that are close--but I can't decipher the code sufficiently to apply it to my needs; and the more I stare at the expression field in AE the less capable I'm becoming...
Any help much appreciated.
Actually worked this out before my post even went live. Added a modulus to the above code to get
fadeTime = effect("Fade In/Out")("Slider")/25;
onTime = effect("On Time")("Slider")/25;
fadeDur = fadeTime*2+onTime;
t = time%fadeDur;
fadeInOpacity = linear(t, inPoint, inPoint+fadeTime, 0, 100);
fadeOutOpacity = linear(t, fadeTime+onTime, fadeDur, 100, 0);
(fadeInOpacity * fadeOutOpacity) / 100
I guess searching / staring at all the different examples somehow got something though...
Ok, so it turns out I hadn't solved my own problem after all--mainly because it's not just the opacity expression I need; I also need to time remap a random freeze frame and a random colour change (from a set palette) at the same time as the fade up / fade down--basically a new frame / colour every time opacity reaches zero. On top of that, a second layer also needs to randomly change colour over the same period as fade up / fade down.
I've confused myself with all of that--and it's my project! Maybe an actual description will help...
I have a set of icons (currently 38, but could increase), all 1 frame in length, in a 38 frame precomp. Around that precomp is a border. I want to randomly select a frame from the icon precomp and hold on it for a set amount of time (ideally set by a slider in a master comp) and have it fade out over a set time (again on a slider) then change frame and colour (via a Tint / Fill effect) then fade up again (same as fade out time). Meanwhile the border will, as the icon fades out / in, change from one random colour to another (without fading in / out).
I have some of this working--but can't get the timing of each change to coincide, even though the timings are all supposedly linked to the same master sliders...