After Effects

Slice an image in AfterEffects for making prints or ???

The following code will let you take an image… let’s say a photograph and slice it up into a bunch of tiles that can be saved and printed.
Step 1: Create a ‘render comp’ that is the size of the print you will want (ie. for a 4″x6″ print @ 300dpi, you would set the comp to be 1200px X 1800px) (this script assumes a framerate of 24fps)
Step 2: Place your photo/image/precomp into this render comp.
Step 3: Paste the following as an expression into the image layers’ ‘Anchor Point’ property…
compWidth = thisComp.width;
compHeight = thisComp.height;
srcWidth = width;
srcHeight = height;
countX = Math.ceil(srcWidth / compWidth);
countY = Math.ceil(srcHeight / compHeight);
centerOffsetX = (srcWidth%compWidth)/2;
centerOffsetY = (srcHeight%compHeight)/2
frame = time*24;
xCount = Math.ceil(srcWidth / compWidth);
yCount = Math.ceil(srcHeight / compHeight);
indexX = frame % xCount;
indexY = Math.floor(frame/xCount);
half_height = compHeight/2;
x = compWidth*indexX;
x += centerOffsetX;
y = compHeight*indexY;
y += centerOffsetY;
Step 4: Step through the render comp frame by frame and you should see the image moving to a new position each frame, that will seamlessly stitch back together. Render out an image sequence and send them off to the printer!

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);

Add a little bounceback…


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.