<p>There's no property called <code>xPosition</code>, and <code>transform</code> is a property of a layer, not a method, but you're on the right track. The expression has to return an array of two values [x, y], and the components of the position are stored in an array like that too. The expression you want — if you're applying it to the layer position property — is this:</p>

<pre class="lang-js prettyprint-override"><code>xpos=thisComp.layer("Blue").effect("CC Particle World")("Position X");
ypos=transform.position[1];
[xpos, ypos]
</code></pre>

<p>That will apply the value of the <code>Position X</code> property of the effect to the <strong>X</strong> position of the layer, and the current <strong>Y</strong> value of the layer to the <strong>Y</strong>.</p>

<p>If you're trying to use the layer's <strong>X</strong> position on the effect's Position <strong>X</strong> property then you need to use:</p>

<pre class="lang-js prettyprint-override"><code>thisComp.layer("Blue").transform.position[0]
</code></pre>

<p>you only need one value for this property.</p>

<blockquote>
  <p><strong>Pro Tip</strong> a great way to learn how properties are accessed in expressions, as well as being a super quick and typo-free way of
  creating them is to use the pickwhip. Next to the expression box
  you'll see a curly icon. Click that and drag it to the property you
  want to reference in your expression. So in the second case you could
  drag it to the number for the <strong>X</strong> value of the layer's position and it
  would give you the correct syntax for accessing it.  </p>
  
  <p><img src="https://i.sstatic.net/Z19IM.png" alt="enter image description here"></p>
</blockquote>

<p>A good place to learn more about expressions is Dan Ebbert's page: <a href="http://motionscript.com/" rel="nofollow noreferrer">http://motionscript.com/</a></p>

CC BY-SA 3.0
2015-05-26T14:08:08.010Z
You're welcome, here is the meta: http://meta.video.stackexchange.com/questions/1449/syntax-highlighting, I hope we get a detailed explanation soon.
p2or
CC BY-SA 3.0
2015-05-26T13:41:26.603Z
2015-05-28T03:48:23.220Z
2015-05-28T03:48:23.220Z
stib
<p>I have a layer called Blue.</p>

<p>I applied CC Particular World to a ShapeLayer with an animated separated X Position (with 3 keyframes).</p>

<p>The thing is that the effect doesn't move along with the shape.
So either I animate the Producer features "Position X" with keyframes or I would parent this feature to xPosition.</p>

<p>I just don't know if this is possible and if so how?</p>

<p>I invented this script...</p>

<pre><code>    thisComp.layer("Blue").effect("CC Particle World")("Position X").transform("xPosition")
</code></pre>

<p>it results in error!</p>

<p>Thank you for your help.</p>

<p>H.</p>

<after-effects-expressions>
Parent a Position X from Particular World to it's own transform xPosition
Horacsio
# Parent a Position X from Particular World to it's own transform xPosition

(Asked by: username_0 on 2015-05-25)

I have a layer called Blue.
I applied CC Particular World to a ShapeLayer with an animated separated X Position (with 3 keyframes).
The thing is that the effect doesn't move along with the shape.
So either I animate the Producer features "Position X" with keyframes or I would parent this feature to xPosition.
I just don't know if this is possible and if so how?
I invented this script...
    thisComp.layer("Blue").effect("CC Particle World")("Position X").transform("xPosition")

it results in error!
Thank you for your help.
H.

**Tags:** after-effects-expressions


---

## 1 answers

### Answer by username_1 on 2015-05-26. Score: 3

There's no property called xPosition, and transform is a property of a layer, not a method, but you're on the right track. The expression has to return an array of two values [x, y], and the components of the position are stored in an array like that too. The expression you want — if you're applying it to the layer position property — is this:
xpos=thisComp.layer("Blue").effect("CC Particle World")("Position X");
ypos=transform.position[1];
[xpos, ypos]

That will apply the value of the Position X property of the effect to the X position of the layer, and the current Y value of the layer to the Y.
If you're trying to use the layer's X position on the effect's Position X property then you need to use:
thisComp.layer("Blue").transform.position[0]

you only need one value for this property.

Pro Tip a great way to learn how properties are accessed in expressions, as well as being a super quick and typo-free way of
  creating them is to use the pickwhip. Next to the expression box
  you'll see a curly icon. Click that and drag it to the property you
  want to reference in your expression. So in the second case you could
  drag it to the number for the X value of the layer's position and it
  would give you the correct syntax for accessing it.  


A good place to learn more about expressions is Dan Ebbert's page: http://motionscript.com/

> **Comments:**
> **username_2**: You're welcome, here is the meta: http://meta.video.stackexchange.com/questions/1449/syntax-highlighting, I hope we get a detailed explanation soon.  

---

