After Effects

AE Bounce and Overshoot Expressions

Just came across these. Why didn’t I find them soon?

Keyframe Overshoot Expression:

freq = 3;
decay = 5;

n = 0;
if (numKeys > 0){
  n = nearestKey(time).index;
  if (key(n).time > time) n--;
}
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);
}else
  value

Add a little bounceback…

(more…)

Javascript number to number with commas trick

Came across this simple function that works nice in After Effects:

function numberWithCommas(x) { return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); }

Now you can have rolling counters by just adding a custom slider control and keyframing the start and end values.

After Effects Expression Tips

Here are some of the latest tricks I have been playing around with, especially useful with Particular.

Tip: Add a ‘layer for motion’ selector for your particular emitter and make your keyframing easier.

Add an Effects>Expression Controls>Layer Control to the layer and name it ‘layerForMotion’

Add these expressions to the particular emmitter properties:

In Position XY:

try {
 m= effect("layerForMotion")("Layer").transform.position;
 [m[0],m[1]];
 }catch(err){
 effect("Particular")("Position XY");
 }

In Position Z:

try {
 m= effect("layerForMotion")("Layer").transform.position;
 m[2];
 }catch(err){
 effect("Particular")("Position Z");
 }

Now just select the layer that you want to control the emmitter. Be sure to convert that layer to 3D before selecting.

Tip:Adjust the amount of particles emitted based on the velocity (speed) of the emitter.

[UPDATE – also, have it stop emitting when it stops.  No need to keyframe ‘0’ ]
This is helpful when you get thin or clumpy areas of particles when you are moving your emitter at various speeds.
Add the following expression to the Particular ‘particles/sec’ property:

//specify the where the motion for the emitter is coming from
 m=effect("layerForMotion")("Layer").transform.position
 //get the magnitude of the position change (ie speed) and combine with attribute value you set or keyframed
 length(m.velocityAtTime(time))*effect("Particular")("Particles/sec")/2000;
 //omit this if you don't what it to stop emitting when it stops moving
 if (m==0){
 0; //stop emitting if no change in position
 }

Now you will get a nice even stream no matter how you zip the emitter around, and it will stop emitting when standing still so no more clusters!