This Expression is for situations where you only need to affect the Y dimension if Separate Dimension is not available.
In After Effects, when you want to link only the Y dimension of a two-value property (like Shift Center To) to a Slider Control, you need to write a custom expression. Here's how you can do it:
Steps:
- Alt/Option + Click the stopwatch next to "Shift Center To" to enable expressions.
- You'll see something like:
[value[0], value[1]] - Replace or edit the expression to something like this:
x = value[0]; // keep the original X
y = thisComp.layer("Null 1").effect("Slider Control")("Slider"); // link Y to slider
[x, y]
What this does:
- value[0]: retains the current X value of the "Shift Center To" property.
- thisComp.layer("Null 1").effect("Slider Control")("Slider"): fetches the slider's value from the Null 1 layer.
- [x, y]: combines them into a two-value array, as required by "Shift Center To".
Optional tip:
If you want to reverse it (e.g., control X instead), just switch the order:
x = thisComp.layer("Null 1").effect("Slider Control")("Slider");
y = value[1];
[x, y]