<p>The position of any point on a layer in terms of its location in the composition frame is given by the layer space transform function <code>toComp()</code>. Since the top left of a layer is the origin in After Effects, from the point of view of the solid its top left is going to be [0, 0]. So we find the position of the point [0, 0] on the layer in terms of the comp thus:</p>

<pre><code>thisComp.layer('&lt;name of the solid&gt;').toComp([0,0])
</code></pre>

<p>Apply that to the position property of the layer you want to stick to the solid.</p>

CC BY-SA 4.0
2018-06-18T05:24:49.063Z
2018-06-18T05:24:49.063Z
stib
<p>I was wondering about a expression that sticks a layer position on to the top left corner of a square solid in After Effects, so that when the scale of the solid changes, the stuck position follows the corner around. Can someone help with this?</p>

CC BY-SA 4.0
2018-06-18T05:13:53.970Z
Is there a reason you want an expression, rather than using parenting?
stib
CC BY-SA 4.0
2018-06-19T18:54:22.423Z
yes there is. I need the object move along with the corner of the other. The object master will scale up and down with the expression sourceRecAtTime and the object child will need  stick on its left corner.
Ronie Silva
CC BY-SA 4.0
2018-06-19T18:55:04.067Z
only position not scale.
Ronie Silva
CC BY-SA 4.0
2018-06-19T23:37:35.560Z
Ok, my answer should work for you.
stib
<video>
Stick a layer position on another top left corner of a square layer in After Effects
Ronie Silva
# Stick a layer position on another top left corner of a square layer in After Effects

(Asked by: username_0 on 2018-06-15)

I was wondering about a expression that sticks a layer position on to the top left corner of a square solid in After Effects, so that when the scale of the solid changes, the stuck position follows the corner around. Can someone help with this?

**Tags:** video

> **Comments:**
> **username_1**: Is there a reason you want an expression, rather than using parenting?  
> **username_0**: yes there is. I need the object move along with the corner of the other. The object master will scale up and down with the expression sourceRecAtTime and the object child will need  stick on its left corner.  
> **username_0**: only position not scale.  
> **username_1**: Ok, my answer should work for you.  

---

## 1 answers

### Answer by username_1 on 2018-06-18. Score: 1

The position of any point on a layer in terms of its location in the composition frame is given by the layer space transform function toComp(). Since the top left of a layer is the origin in After Effects, from the point of view of the solid its top left is going to be [0, 0]. So we find the position of the point [0, 0] on the layer in terms of the comp thus:
thisComp.layer('').toComp([0,0])

Apply that to the position property of the layer you want to stick to the solid.


---

