After Effects Expressions
Inertia
amp = .1;
freq = 2.0;
decay = 2.0;
n = 0; time_max = 4; 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 && t < time_max){ v = velocityAtTime(key(n).time – thisComp.frameDuration/10); value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t); }else{value}
Auto-Fade
transition = 20; // ==frame number if (marker.numKeys<2){ tSecs = transition / ( 1 / thisComp.frameDuration); linear(time, inPoint, inPoint + tSecs, 0, 100) – linear(time, outPoint – tSecs, outPoint, 0, 100) }else{ linear(time, inPoint, marker.key(1).time, 0, 100) – linear(time, marker.key(2).time, outPoint, 0, 100) }
Scale – in
snapScale = 300;
trans = 4;
trans = trans * thisComp.frameDuration;
inTrans = easeOut(time, inPoint, inPoint + trans, [snapScale,snapScale], [0,0]);
outTrans = easeIn(time, outPoint, outPoint – trans, [0,0], [snapScale, snapScale]);
value+ inTrans + outTrans
zoom = 5000; //distance to zoom trans = 4; // transition time in frames trans = trans * thisComp.frameDuration; inTrans = easeIn(time, inPoint, inPoint + trans, [0,0,zoom], [0,0,0]); outTrans = easeOut(time, outPoint, outPoint – trans*2, [0,0,0], [0,0,zoom]); value+ inTrans – outTrans
3d location for 2D attributes
layer = thisComp.layer("Null 1") layer.toComp([0,0,0])