-
Blinking speed and offset
I have two problems with a blinking expression.
I want a layer to blink and then the blink gradually slow down.I tried this expression
freq =effect("frequency")("Slider");
n = Math.sin(time*freq);
if (sw<=0) 0 else 100and this one
freq = effect("frequency")("Slider");
amp = 100;
n = freq.numKeys;if (n > 0 && freq.key(1).time < time){
accum = freq.key(1).value*(freq.key(1).time - inPoint);
for (i = 2; i <= n; i++){
if (freq.key(i).time > time) break;
k1 = freq.key(i-1);
k2 = freq.key(i);
accum += (k1.value + k2.value)*(k2.time - k1.time)/2;
}
accum += (freq.value + freq.key(i-1).value)*(time - freq.key(i-1).time)/2;
}else{
accum = freq.value * (time - inPoint);
}
sw = value + amp * Math.sin(accum * Math.PI * 2);
if (sw<=50) 0 else 100;which I found on motionscript
It works until my frequency is constant but when I use keyframes in the slider the blinking speeds up and then speeds down again when it reaches the new value...
How can I make the blink gradually slow down?
Moreover I want another layer to blink at the same speed but not in sync... Anyone can help?
Thanks