Trying to figure out a way to rotate the lower white string based on the movement of the point where it’s attached to the blue arch.
First I tried the Ponytail Physics by Filip Vandueren, but after playing with the variables, I couldn’t get realistic sway for the bottom string. This has promise though, especially if it used some of the math in the inertial bounce expression below.
inertia = 0.8;
stiffness = 0.25;
lagValue = calcValue(0);
f= thisComp.frameDuration;
will=0;
for (t=0; t<=time; t+=f) {
delta = calcValue(t) - lagValue;
will = will * inertia + delta*stiffness ;
lagValue +=will
}
lagValue-parent.rotation;
function calcValue(t) {
p1=toComp(anchorPoint,t);
p2=toComp(anchorPoint,t-thisComp.frameDuration);
x=p1[0]-p2[0];
y=p1[1]-p2[1];
if (y>0) {
y=y*5; // make *5 variable ?
} else {
y=y*0; // negative Y speed has no effect
}
r=x*2 + y; // make *2 variable
return r;
}
Inertial bounce seems more realistic, but i can’t figure out how to calculate rotation of the lower string based on the position of the null it’s attached to.
// Inertial Bounce (moves settle into place after bouncing around a little)
n = 0;
if (numKeys > 0){
n = nearestKey(time).index;
if (key(n).time > time){
n–;
}
}
if (n == 0){
t = 0;
}else{
t = time – key(n).time;
}
if (n > 0){
v = velocityAtTime(key(n).time – thisComp.frameDuration/10);
amp = .05;
freq = 4.0;
decay = 2.0;
value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}else{
value;
}