-
Continuous bounce
Hi I need help with the “famous” bounce expression. It`s interesting problem and I`m scratched out.
Because frequence and decay are low ( I need it to be extra elastic) it only work for two keyframes.
On keyframe 3 it snaps in its value and sometimes on keyframe 4, 5, 7, 9.. depending on the nearest key index I presume
I`m trying valueAtTime but I`m limited with knowledge.I need my keyframes not to be precise but relative to previous inherited velocity.
Thnx
freq = 0.5;
decay = 1;n = 0;
if (numKeys > 0){
n = nearestKey(time).index;
if (key(n).time > time) n--;
}
if (n > 0){
t = time - key(n).time;
amp = velocityAtTime(key(n).time - .001);
w = freq*Math.PI*2;
value + amp*(Math.sin(t*w)/Math.exp(decay*t)/w);
}else
value
