value and valueAtTime()
In expressions, the value keyword can be used to refer to a property’s own value before the expression is applied.
For instance, if you have animated a complicated scaling animation with hundreds of keyframes and you decide you want the animation to be the same, only half as big, you can use the simple expression.
value/2;
This takes whatever the value of scale was and halves it.
If you use value to refer to a property other than the property that the expression is on, you can only retrieve the post-expression value (if it has an expression). As far as I’m aware, there’s no way to retrieve the pre-expression value of a property from outside that property. For instance, this expression on the scale property…
a = thisLayer.effect("Slider Control")("Slider").value;
[a,a];
…will give the post-expression value of Slider Control (if it has an expression).
valueAtTime(t) works similarly, but this method takes an argument… a value inside the brackets that instructs the valueAtTime method which value to return.
thisProperty.valueAtTime(time+1.2);
The expression above will get the property’s pre-expression value 1.2 seconds ahead of the current time. (the keyword time retrieves the current time in seconds) Note: I’ve used the thisProperty keyword to refer to the property itself. I could also have used valueAtTime(time+1.2) on its own.
If I use the valueAtTime(t) method to refer to another property than the property that the expression is on, it works the same, but refers to the post-expression value of that property if there is an expression.
//on the Scale property
a = thisLayer.effect("Slider Control")("Slider").valueAtTime(time+1.2);
[a,a];
Will get the post-expression property (if it has an expression) of Slider Control, 1.2 seconds ahead of the current time.