-
Trigger Animation based on Markers with the same name on different layers
Hi there,
I’m working on a recurring project where I have to throw lots of subComps into one mainComp and then set keyframes on a Control Layer to trigger a random animation on another layer on each added subComp inPoint. So far I’m doing this via keyframes ( I just have to add a keyframe on a slider on the control layer and the random animation on the other layer starts), but there has to be a way to do this by adding markers on the subComps, right? I could figure it out if the markers were all set on the same layer, but I can’t figure out how to trigger the animation if the markers lie on different layers.
This is the expression I’m currently using to trigger the random animation via keyframes, I hope it’s enough to figure out my problem:
fadeInTime = framesToTime(thisComp.layer(“CONTROL_politicalParties”).effect(“FADE IN/OUT”)(“Slider”));
fadeOutTime = framesToTime(thisComp.layer(“CONTROL_politicalParties”).effect(“FADE IN/OUT”)(“Slider”));
delay = framesToTime(thisComp.layer(“CONTROL_politicalParties”).effect(“DURATION”)(“Slider”));
wig = wiggle(thisComp.layer(“CONTROL_politicalParties”).effect(“WIGGLES PER SEC”)(“Slider”),thisComp.layer(“CONTROL_politicalParties”).effect(“amp_SPD”)(“Slider”));
s = thisComp.layer(“CONTROL_politicalParties”).effect(“START ANI”)(“Slider”);
if (s.numKeys > 0){
n = s.nearestKey(time).index;
if (time < s.key(n).time) n–;
if (n > 0){
t = time – s.key(n).time;
if (t < fadeInTime)
linear(t,0,fadeInTime,0,wig)
else
linear(t,fadeInTime,fadeInTime+delay+fadeOutTime,wig,value);
}else{
value;
}
}else
value