-
Triggering random expression with another layer’s property
I posted a few days ago looking for a way to loop an opacity fade up / stay on / fade down, with fade / stay on times linked to sliders. I actually managed to make that one work myself, starting with another expression from, of all things, a built in preset. What I ended up with was this:
ctrl = comp("MAIN COMP").layer("TIMING CONTROLS");
fadeTime = framesToTime(ctrl.effect("Fade In/Out Time (Frames)")("Slider"));
onTime = framesToTime(ctrl.effect("On Time (Frames)")("Slider"));
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
It works just as I want it to. What I also need to do though–and I replied to my own post in the hopes of finding an answer, but might have overcomplicated things–is trigger two other “events” based on the opacity working on the above expression. I want freeze frames of a precomp to change to another random frame every time the opacity hits zero, so that when it fades back up it will show a different frame. Similarly, I’d like a colour control adjustment layer within the pre comp to cycle randomly though a set of six RGB values, so that each subsequent freeze frame is a different, random colour. I’ve come very close to making it all work, but just can’t quite see my way through it.