Forums › Adobe After Effects › Markers triggers layers
-
Markers triggers layers
-
Jean Livenais
February 27, 2023 at 7:37 amHello,
Can you help me to build an expression where one layer shows up each time the playhead reaches its marker’s name and fades out when the playhead reaches the next marker with an 1s ease transition between each layer? The fade in and the fade out of 2 consecutive layers would occur simultaneously. You can see in the example, the layers can appear randomly one after another.
Thank you
-
Filip Vandueren
February 27, 2023 at 12:25 pmAlthough it may need some extra logic if two consecutive markers have the same name, which they don’t in your example… Something like this:
m = thisComp.marker;
nk = m.nearestKey(time);
pki = nk.index - (nk.time > time && nk.index>1 ? 1: 0);
k = m.key(pki);
if (k.comment==thisLayer.name) {
linear(time,k.time,k.time+1,0,100);
} else if (pki>1 && m.key(pki-1).comment==thisLayer.name) {
linear(time,k.time,k.time+1,100,0);
} else {
0;
} -
Jean Livenais
March 1, 2023 at 4:18 pmThank you Filip, it works great.
Is there a way to start the transition before and end the transition after each marker, so that the marker is half way of each transition?
I tried to modify the code but it didn’t turn as wished.
-
Filip Vandueren
March 1, 2023 at 9:08 pmI think you only need to change line 2 into nk = m.nearestKey(time+0.5) ; but I haven’t tested.
-
Jean Livenais
March 3, 2023 at 8:14 pmI tried and the transition stay the same.
Maybe with some negative value with the posterize function.
Thanks
Log in to reply.