I spent a while tweaking that code, but can’t get beyond making it work with the glow intensity property instead of the position property.
I read your posts here. The codes are similar, and I’m thinking I could integrate a looping array into the code you linked me to, but I’m not sure how to go about that. Would it be possible to use “thisProperty” to continuously multiply the glow intensity value by decimal numbers stored in the array in order to achieve the “100%, 75%, 50%” cycle I’m looking for?
Also, I’m splitting hairs, but would there be a way to have the glow still decay at the same speed as the audio output? I notice that with this code, the decay rate of the glow is a fixed value instead of decaying as fast/slow as the sound does.
threshold = 38;
audioLev = thisComp.layer("Sound Keys").effect("Sound Keys")("Output 1");
above = false;
frame = Math.round(time / thisComp.frameDuration);
while (true){
t = frame * thisComp.frameDuration;
if (above){
if (audioLev.valueAtTime(t) < threshold){
frame++;
break;
}
}else if (audioLev.valueAtTime(t) >= threshold){
above = true;
}
if (frame == 0){
break;
}
frame--
}
if (! above){
t = 0;
}else{
t = time - frame * thisComp.frameDuration;
}
amp = 100;
freq = 2;
decay = 2.0;
angle = freq * 2 * Math.PI * t;
glow = 1 + amp * Math.sin(angle) / Math.exp(decay * t) / 100;
thisProperty * glow;