When you have a layer with many keyframes applied to it, may it be by you, by the tracker, by the wiggler, by expressions converted to keyframes, by motion sketching, or any other technique, you may feel that even though everything is looking good, there is a slight offset in position, scale, opacity or rotation that would make your animation look much better.
Problem is, having so many keyframes, it would be a hassle to go into the timeline and edit each one individually.
Here is a concrete example : I tracked a stick, that a character is holding. There is some movement in the stick, as if the flag holder was in a windy location. There was no flag in the shot, so I created a solid that I tracked to the stick.
Once the keyframes where applied, I realized the flag was slightly offset from the flag, perhaps because my attach point wasn't perfectly placed.
At any rate I needed to offset the positon for ALL my keyframes.


I found that I could offset position on the X axis using this expression on the "position" stream:
position +15
But I also wanted to offset the Y axis, at this point I needed some help from Paul Tuersley. He explained that "position" is an example of an array, which just means something that stores more than one value (position has an X value and a Y value).
This is how arrays are written in expressions:
[10, 20]
That expression would set a layer's position to 10 on the X axis and 20 on the Y axis.
To add two arrays together, you would write an expression like:
[10,20] + [15, -2]
So that's 10 + 15 and 20 - 2, which results in [25, 18].... setting the layer's position as 25 on X and 18 on Y.
In the expression language the word "position" represents an array that you could think of as [current X position, current Y position] so the expression I needed for my offset is really just another example of adding two arrays together:
position + [15,-2]
With the result being that all my position keyframes have been offset by +15 on the X axis and -2 on the Y axis.
Paul also pointed out that although my original expression (that just offset the X axis) position + 15 worked, I should really get used to writing it as:
position + [15,0]
You can use this technique for offsetting pretty much any parameter in After Effects. Just remember that for things like anchor point, position or scale which have 2 (x,y) or 3 (x,y,z) values, you are dealing with arrays and need to use this method:
anchorPoint + [-23, 40]
scale + [0, 0, 100]
Whereas, if the parameter only has one value, such as opacity or rotation, you can just use:
opacity - 20
rotation + 90
---------
A little note : AE is a powerful app that often gives you more than one way to solve problems. In this case I could have parented my layer to a null, then used that null to offset the original layer's position.