# How to apply an offset to one axis only in 3D space for linked expression position?

I have a 3D position property linked with another composition. I want the z-axis to have an offset in the linked expression. But how can I apply an offset just to one axis?

The current expression of the 3D position:

``````comp("Main COMP").layer("text").transform.position
``````

## 1 Answer

The position property is an array, which is a container with a number of components in it, in this case the three position values: x, y and z. To specify an array you use this notation `foo = [A,B,C]` where A, B and C are the individual values – constants, variables, whatevs. TL;DR to create an array you put a number of comma-separated values in square brackets.

Conversely you can access any of the components of an array using this notation: `foo[n]` where foo is the name of the variable, and `n` is the index of the component you want. Note that the index starts at 0, so to get the first component of the array you would use `foo`, the second `foo` and so on. Arrays can also be multi-dimensional, so the address could be `foo` for a three dimensional array. But you probably don't need to worry about that at this point.

In your case you want just the third component to have the offset. So you need to unpick the original array using the `foo`, `foo`… notation and then put it back together as an array using the `[A,B,C]` notation. Thus:

``````thePos = comp("Main COMP").layer("text").transform.position;
[thePos, thePos, thePos+offset]
``````

where `offset` is whatever your offset is, obviously.

The first line is just for convenience - it assigns the position property as the value of the variable myPos. You could do it all on one line, but it gets a bit hard to read:

``````[comp("Main COMP").layer("text").transform.position, comp("Main COMP").layer("text").transform.position, comp("Main COMP").layer("text").transform.position+offset]
``````