I’m getting closer, but it’s still the time that’s the issue, I need to replace the inPoint value with the timestamp from when y is clamped.
xPosStart = 1200;
yPosStart = 540;
parentPos = thisComp.layer("Null 1").transform.position;
gravity = 10;
distance = length(transform.position,thisComp.layer("Null 1").transform.position);
rope_length = 400;
if (distance >= rope_length){ // once the null is at the max length of the rope, kick in Dan Ebberts's overshoot expression
t = time - xStartTime;
freq = 3;
decay = 5;
startVal = [xPosStart,y];
endVal = [parentPos[0],parentPos[1]-rope_length/2];
dur = 0.1;
if (t < dur){
linear(t,0,dur,startVal,endVal);
} else {
amp = (endVal - startVal)/dur;
w = freq*Math.PI*2;
endVal + amp*(Math.sin((t-dur)*w)/Math.exp(decay*(t-dur))/w);
}
} else { // Fall straight down, until at end of rope
xStartTime = time;
yPos = gravity*100*time*time;
y = clamp(yPos,yPosStart,yPosStart+rope_length);
[xPosStart,y];
}
It’s not giving me an error, but it’s stopping