Mrz 11, 2020

Meine Adobe After Effects Expressions Favorites

Fade-In Fade-Out Expression

fadeInTime = .5; // fade in time (seconds)
fadeOutTime = .5;
Math.min(linear(time,inPoint,inPoint + fadeInTime,0,100),linear(time,outPoint - fadeOutTime,outPoint,100,0))
 

Offset/Follow Mask Expression

//input variables – pickwhip tPath to your path and offsetPos to your null or expression controller
var tPath = mask(“Mask 1”).maskPath;
var offsetPos=effect(“Mask Position Offset”)(“Point”);
var tPoints=[];
var InTan=[];
var OutTan=[];
var mPos=offsetPos-[thisComp.width/2,thisComp.height/2];
var tClosed=tPath.isClosed();
for(i=0;i<(tPath.points().length);i++)
{
tPoints.push([tPath.points()[i][0]+mPos[0],[tPath.points()[i][1]+mPos[1]]],);
InTan.push([tPath.inTangents()[i][0],[tPath.inTangents()[i][1]]],);
OutTan.push([tPath.outTangents()[i][0],[tPath.outTangents()[i][1]]],);
}
createPath(tPoints, InTan, OutTan,tClosed)
https://gist.github.com/anonymous/c3b4591c11cc9fc12d4bdf36b931940f

 

Marker based expression in After Effects

var wiggleSpeed=10;
var wiggleAmplitude=100;
var easeDur=20;

try{

if(time>=thisLayer.marker.nearestKey(time).time){
T=thisLayer.marker.nearestKey(time).index;
}else{
T=thisLayer.marker.nearestKey(time).index-1;
}

key1=thisLayer.marker.key(T)

if (key1.time s=linear(time,key1.time,key1.time+(easeDur*thisComp.frameDuration),0,1);
ss=linear(time,(key1.time+key1.duration)-(easeDur*thisComp.frameDuration),(key1.time+key1.duration),1,0);
wiggle(wiggleSpeed,wiggleAmplitude*s*ss);
}else{
value;}

}catch(error) {
value;
}

 

Interpolation zwischen Random Numbers by Dan Ebberts

segMin = .3; //minimum segment duration
segMax = .7; //maximum segment duration
minVal = [0.1*thisComp.width, 0.1*thisComp.height];
maxVal = [0.9*thisComp.width, 0.9*thisComp.height];

end = 0;
j = 0;
while ( time >= end){
  j += 1;
  seedRandom(j,true);
  start = end;
  end += random(segMin,segMax);
}
endVal =  random(minVal,maxVal);
seedRandom(j-1,true);
dummy=random(); //this is a throw-away value
startVal =  random(minVal,maxVal);
ease(time,start,end,startVal,endVal)