Tuesday, August 14, 2012

Evidently I haven't drawn anything for like 3 years so now for a while this will be a notepad of useful After Effects Expression clippings I mostly found/stole elsewhere, sometimes modified myself a bit.

Posterize time with offset.

Use it on Time Remapping to make a clip have a low frame rate which falls on a specific frame eg to match another piece of low frame rate animation.

fps=12; 
phase=180; 
posTime =(Math.floor(time*fps+phase/360)-phase/360) /fps; 
valueAtTime(posTime); 

Attach the phase to an Angle expression control and animate with hold keyframes if you need to make it stay in sync with irregularly keyframed animation

fps=12;
phase=effect("Angle Control")("Angle");
posTime =(Math.floor(time*fps+phase/360)-phase/360) /fps;
valueAtTime(posTime); 

I used this to make a live action background play at a lower frame rate perfectly in sync with rotoscoped animation which had different parts done on 2s and 3s, and a few accidental missed frames here and there throwing things off.

Taken from http://forums.creativecow.net/thread/227/13759

Audio files in 3D space!

(EDIT: actually not sure if this is really working properly at alll)

This seemed a bit clunky and confusing to me at first but it appears to work OK and I couldn't have come up with it myself so can't complain. :) Controls the volume and panning of audio layers based on distance from comp/camera. Might try and improve it some time; at the moment it works by you put the expression on the 'Audio Levels' of the audio file and the object controlling the position in space underneath that layer, which isn't a workflow I like really. Will probably attach loudMax and loudMin etc. to master sliders for easier tweaking too.

loudMax = 0; //The loudest that the audio file will ever be in dB
loudMin = -20; // The quietest that the audio file will ever be in dB
close = -10; // The smallest Z value expected
far = 1000; // The largest Z value expected
distance = thisComp.layer(index+1).transform.position[2]; //The Z value of the layer beneath this one
myLevel = linear(distance, close, far, loudMax, loudMin);
myWidth = thisComp.width;
//The following section is new and required for the change to the 'balance' equation:
motionLayer = thisComp.layer(index+1);
halfWidth = motionLayer.width / 2;
halfHeight = motionLayer.height / 2;
balance = motionLayer.toComp([halfWidth,halfHeight])[0]; //This is a new form of this equation that converts the XYZ coords of the layer to screen X coordinates for more realistic panning
leftMult = linear(balance, 0, myWidth, 1, 2);
rightMult = linear(balance, 0, myWidth, 2, 1);
myLeftLevel = myLevel * leftMult;
myRightLevel = myLevel * rightMult;
[myLeftLevel, myRightLevel];

Stolen from 'wuzelwazel' on this olde thread: http://forums.creativecow.net/thread/227/7223#7236

No comments: