Is there an easier way (reacting to gravity)?

Hawk Teflon

Veteran
I'm setting up a line of photos / facts that will be "pulled" toward the static camera. I'm imagining it as though there is a small hole in the top of each photo, and connected to a string. When you pull the string, the stuff comes to you. Makes sense, right? Well, I know it's not going to react right without some expressions / keyframing. When they get close to the camera and stop suddenly, I want them to swing back and forth to a slow down. Is there and easy expression / effect I can add for this, or do I need to keyframe it all. I CAN keyframe it, but if there is a timesaver, I'd like to implement it.

Thank you in advance!
 
This expression should do the trick, basically an Intertial Bounce where you apply it to your keyframed value and it will do the rest for the intertia based on the velocity and spatial properties. You can modify the decay, amp, and freq in the middle to taste. I like to link them to sliders on a null to control them.

Code:
// 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;
}

If you wanted to link the amp, freq, and decay properties to sliders just replace the values with this:

Code:
amp = thisComp.layer("LAYER NAME").effect("Slider Control")("Amp Slider")
freq = thisComp.layer("LAYER NAME").effect("Slider Control")("Freq Slider")
decay = thisComp.layer("LAYER NAME").effect("Slider Control")("Decay Slider")

By default the Slider effect will be named “Slider”, so you should rename them to Amp, Freq and Decay. I've renamed them in the expression. The “LAYER NAME” is the name of the layer with the expression control effect on it.
 
Brilliant! Thank you!

EDIT: Now that I think about it, running a camera through all of that would be easier for keeping distances constant. Will the above method work just as well if I rush the camera through, and still keyframe the first point?
 
Last edited:
Back
Top