Hover effect without keyframes

Hover Expression for any parameters:

pointer = thisComp.layer("Pointer"); 
hoverStart = 60; // The higher value, the larger zone of influence 
hoverEnd = 20; // The higher value, the smaller zone at which influence will stop 
maxValue = 0.7; // Multiplies the maximum value 

L = length(toComp(anchorPoint), pointer.toComp(pointer.anchorPoint)); 
C = clamp(hoverStart-L,0,hoverEnd); 

value + C*maxValue

(more…)

Position linked to Angle Control

With this expression, you can animate an object along only one axis, using a Slider, and then change the direction of motion using Angle Control. Applies to the layer’s Position parameter.

p = effect("Slider Control")("Slider"); 
a = effect("Angle Control")("Angle"); 
r = degreesToRadians(a-90);
x = p*Math.cos(r);
y = p*Math.sin(r);
value + [x,y]

Auto-Orient Along Path

Analogue of the standard “Transform > Auto-Orient“, but created using the expression and the ability to adjust the degree of smoothness of the rotation animation.

try{
cornerEase = 3;
p = transform.position;
t = Math.min(Math.max(time,p.key(1).time+.001),p.key(p.numKeys).time);
pre = position.valueAtTime(t-thisComp.frameDuration*cornerEase);
post = position.valueAtTime(t+thisComp.frameDuration*cornerEase);
delta = post-pre;
orient = radiansToDegrees(Math.atan2(delta[0],-delta[1]));
value+orient+180
}catch(err){value}

Shift animation by markers

Using this expression, you can shift the beginning and ending of the animation using two markers.
The first marker to shift the animation of the first two keys, that is, the beginning.
The second marker to shift the animation of the third and fourth keys, that is, the ending of the animation.

try{
if(marker.numKeys>1&&numKeys>1){
beginAnim=marker.key(1).time;
endAnim=marker.key(2).time;
markerMoveTime=endAnim-beginAnim;
keyStart=key(1).time; 
keyStartN=key(2).time;
keyEnd=key(3).time;
if(time>=beginAnim && time<=endAnim)
{if((time-beginAnim)>=(keyStartN-keyStart)){valueAtTime(keyStartN);}
else valueAtTime(keyStart+(time-beginAnim));
}
else if(time>endAnim)
{valueAtTime(keyEnd+(time-endAnim));}
else if(time<beginAnim) {valueAtTime(keyStart);}
else {value;}
}else value;
}catch(err){value;}

startValue endValue

Expression for keyless animation.

duration = 1; // Duration of animation in seconds
startVal = 0; // Start value
endVal = 100; // End value
endTime = inPoint+duration;
Math.round(linear(time,inPoint,endTime,startVal,endVal))

Look At

This expression will make the object rotate so that it always looks at the target layer.

Target = thisComp.layer("Target");
delta = thisLayer.toComp([0,0]) - Target.toComp([0,0]);
radiansToDegrees(Math.atan2(delta[1],delta[0]))+value

Limit the distance between two layers

With this expression, you can limit the distance between two layers, so that the distance does not exceed the specified value. Applies to the Position parameter.

For 2D-layers:

centre=thisComp.layer("Centre");
radius = 512; // Maximum distance
x0=value[0]-centre.transform.position[0];
y0=value[1]-centre.transform.position[1];
distance0 = Math.sqrt(x0*x0+y0*y0);
distance = Math.min(distance0,radius);
if (distance0>radius){
distance_mult = distance/distance0;
}else{
distance_mult = 1
}
x=centre.transform.position[0]+distance_mult*x0;
y=centre.transform.position[1]+distance_mult*y0;
[x,y]

For 3D-layers:

centre=thisComp.layer("Orbit");
radius = 505;
x0=value[0]-centre.transform.position[0];
y0=value[1]-centre.transform.position[1];
z0=value[2]-centre.transform.position[2];
distance0 = Math.sqrt(x0*x0+y0*y0+z0*z0);
distance = Math.min(distance0,radius);
if (distance0>radius){
distance_mult = distance/distance0;
}else{
distance_mult = 1
}
x=centre.transform.position[0]+distance_mult*x0;
y=centre.transform.position[1]+distance_mult*y0;
z=centre.transform.position[2]+distance_mult*z0;
[x,y,z]

Start typing and press Enter to search