-
Pendulum expression that works with external values please?
Hi there.
I have rigged a character, and her hair is linked to the rotation of the head, body and torso with a time delay to automate the hair movement (i.e. the hair stays downwards), with the possibility of keyframing via expression controls.
But it doesn’t look completely right yet, and I want to include a pendulum-ish expression, which in theory would work great!
I found an expression online (which I modified a bit to make it easier to see what’s going on, since I’m pretty new to Java-language), but it’s not working properly.
It seems that I can’t use this expression with external values, i.e. only the keyframes in the same property has any effect on the expression. Are there any clever workarounds to this? Or perhaps another type of expression?
Thank you!
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*0.1);
amp=50;
freq=5.0;
decay=5.0;
value+(v*0.01)*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}else{;
value;
Sorry, there were no replies found.