At first I thought the same, but that doesn’t seem to work. I’m pretty sure the part in the “if” and not the part in the “else” is in control for the rest of the comp’s timeline. For example, if I replace “value + amp*(Mat.sin(t*w)/Math.exp(decay*t)/w)” with “wiggle (1,100)” then the layer does indeed wiggle, but it doesn’t overshoot. Which makes sense of course because I’ve removed the line of code that actually affects the values during the overshoot, but I mean it just as an example of which part of the code is controlling the position value after the second keyframe–if any of that makes sense :). I tried adding a “wiggle (1,100)” in there so that it looks like this:
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);
wiggle(1,100);
But of course that doesn’t work, either, since wiggle subsumes the rest of the script.