/**
* The following expression will allow you to access the layer above
* See the examples below for how to use it in practice
*/
thisComp.layer(index-1);
/**
* Access the position of the layer above:
**/
thisComp.layer(index-1).position;
Note: For this example, you will first need to do the following:
var x_offset = effect("X Offset")("Slider");
var y_offset = effect("Y Offset ")("Slider");
var layer_above = thisComp.layer(index-1);
var x_pos = layer_above.position[0] + x_offset;
var y_pos = layer_above.position[1] + y_offset;
[x_pos, y_pos];
Note: For this example, you will first need to do the following:
var x_offset = effect("X Offset")("Slider");
var y_offset = effect("Y Offset")("Slider");
var z_offset = effect("Z Offset")("Slider");
var layer_above = thisComp.layer(index-1);
var x_pos = layer_above.position[0] + x_offset;
var y_pos = layer_above.position[1] + y_offset;
var z_pos = layer_above.position[2] + z_offset;
[x_pos, y_pos, z_pos];