The Expressions Cheat Sheet
Loading...
linear(value, rangeStart, rangeEnd, newRangeStart, newRangeEnd);

linear in After-Effects let us blend between values. In its more complex form, it lets us remap a value to a certain range.

I know this can be a little confusing at first, so let's try to look at it from a practical point of view.

Remapping time to degrees

Our timeline here on the website runs from 0 to 10 seconds. If we use the keyword time, we can get a number between 0 and 10 at any given moment.
If we wanted to remap this value into a new range we can use linear to do so.
In this case, we will remap 0 -> 10 into something we can use as degrees, like -90 -> 90

linear(time, 0, 10, -90, 90);

All it does is some math in the background to make sure any value between 0 and 10 will be "stretched" to the new range.

Remapping and Converting

Remapping time to a color

linear lets us remap and convert from numbers to arrays. Let's again remap time, but this time to color.

linear(time, 0, 10, [0,0,0,0] , [1,1,1,1]);

Colors in After-Effects expressions are usually specified in normalized RGBA.
[0,0,0,1] is Black, [1,1,1,1] is white. Because both are arrays of the same size, linear will blend between them. The result is a smooth transition between black and white across time.

Remapping time to points in space

You might notice a pattern with this one. Points in space are arrays as well, just like colors. There is no real difference in the way linear treats those.
Points can be either 2D or 3D, which means arrays of size 2 or 3. Let's go with 2D points:

linear(time, 0, 10, [0,0] , [20,20]);