<p>I think what you're asking to do is simple using <a href="https://helpx.adobe.com/uk/after-effects/user-guide.html/uk/after-effects/using/expression-basics.ug.html" rel="nofollow noreferrer">Expressions</a>.
If you alt-click on the stop watch of any keyframe-able control you can write an expression to connect that control to another control.
So if you want to control the end of ramp's x position using the start of ramp's x position in your example, it would be:</p>
<pre><code>x = 4480-(effect(&quot;Gradient Ramp&quot;)(&quot;Start of Ramp&quot;)[0]);
y = 1080;
[x,y];
</code></pre>
<p><a href="https://i.sstatic.net/CszPN.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/CszPN.png" alt="screengrab" /></a></p>
<p>The [0] indicates an <a href="https://aeexpressions.blogspot.com/2006/07/lesson-2-arrays-and-variables.html" rel="nofollow noreferrer">array</a> - it means &quot;take the x position of the &quot;start of ramp&quot;, which has two values, x and y, which can be called as [0] or <a href="https://i.sstatic.net/CszPN.png" rel="nofollow noreferrer">2</a> in the array.</p>
<p>To duplicate this in another layer, duplicate your first layer using cmd+D, then add an Expression to the start of ramp in the duplicated layer:</p>
<p><a href="https://i.sstatic.net/sFACa.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/sFACa.png" alt="grab2" /></a></p>
<p>You can use the <a href="https://www.premiumbeat.com/blog/pick-whip-adobe-after-effects/" rel="nofollow noreferrer">pickwhip</a> to select the control you want to enter into the expression</p>

CC BY-SA 4.0
2021-02-02T23:52:59.110Z
A more robust way of doing this is to avoid hard-coded constants and use `x = thisComp.width - (effect("Gradient Ramp")("Start of Ramp")[0]);` and `y = thisComp.height;`. You can use this in any comp and it will be right.
stib
CC BY-SA 4.0
2021-01-29T18:05:00.303Z
2021-01-29T18:05:00.303Z
tomh
<p>e.g.</p>
<p>my composition width is 4480</p>
<p>I have a layer with a gradient ramp effect with an x start positon of 1026 and I want to generate and store the value of the x position on the other side of the composition which would be 3454.</p>
<p>Then have a duplicate of that effect on another layer get the stored value or have the value sent to it</p>

<after-effects><automation>
In After Effects how can I generate the value of an opposite x position and then send that value to an effect on another layer?
tpg
# In After Effects how can I generate the value of an opposite x position and then send that value to an effect on another layer?

(Asked by: username_0 on 2021-01-28)

e.g.

my composition width is 4480

I have a layer with a gradient ramp effect with an x start positon of 1026 and I want to generate and store the value of the x position on the other side of the composition which would be 3454.

Then have a duplicate of that effect on another layer get the stored value or have the value sent to it

**Tags:** after-effects, automation


---

## 1 answers

### Answer by username_1 on 2021-01-29. Score: 2

I think what you're asking to do is simple using Expressions.
If you alt-click on the stop watch of any keyframe-able control you can write an expression to connect that control to another control.
So if you want to control the end of ramp's x position using the start of ramp's x position in your example, it would be:
x = 4480-(effect("Gradient Ramp")("Start of Ramp")[0]);
y = 1080;
[x,y];


The [0] indicates an array - it means "take the x position of the "start of ramp", which has two values, x and y, which can be called as [0] or 2 in the array.
To duplicate this in another layer, duplicate your first layer using cmd+D, then add an Expression to the start of ramp in the duplicated layer:

You can use the pickwhip to select the control you want to enter into the expression

> **Comments:**
> **username_2**: A more robust way of doing this is to avoid hard-coded constants and use `x = thisComp.width - (effect("Gradient Ramp")("Start of Ramp")[0]);` and `y = thisComp.height;`. You can use this in any comp and it will be right.  

---

