AE Expressions

Hello everyone,

In this post I’ll share my findings regarding AE expressions.

Cheers

#001 lenght(A,B)
This expression calculates the length between two objects (A and B). This can be usefull with if, then, else expressions.

#002 degreesToRadians(degrees) & radiansToDegrees(radians)
When using trigonometric related expressions, you need to convert degrees into radians.

#003 Math.PI
When you need the value of Pi in your calculations.

#004 Math.sin(value), Math.cos(value) & Math.tan(value)
These expression can calculate sine, cosine and tangent values.

#005 Math.asin(value), Math.acos(value) & Math.atan(value)
These expression can reverse calculate sine, cosine and tangent values. However you need to multiply them by 180 and divide it by Pi.
For example Math.asin(value)*180/Math.PI

#006 Math.abs(value)
This expression is used to calculate the absolute value.

#007 index
This expression can be used to link a certain value to the index of the layer. For example the rotation value 60*index

#008 Convert a 3D position into a 2D position
target=thisComp.layer(«A»);
fromComp(target.toComp(target.anchorPoint));

#009 Maintain Stroke width even if the scale changes
value / length(toComp([0,0]), toComp([0.7071,0.7071])) || 0.001;