Answers.Body: <p>On the second line: <code>Math.round(easeOut(time,inPoint+0.53,inPoint+1.8, 0, x))</code> returns a value. Since expressions use the first line that returns a value as the value of the property it is trying to use the result of that line as the value for position, and since it only has one dimension it's causing an error.</p>
  <p>Change that line to</p>
  <pre><code>x = Math.round(easeOut(time,inPoint+0.53,inPoint+1.8, 0, x));
  </code></pre>
  <p>(don't forget the semicolon at the end).</p>
  <p>What the amended line is doing is taking the result of the <code>Math.round()</code> function and updating the value of x with that result.</p>
  <p>Just as best practice, you should also use a <code>let</code> on the first line, i.e.</p>
  <pre><code>let x = clamp(thisComp.layer(&quot;Control Values&quot;).effect(&quot;Value Bar 1&quot;)(&quot;Slider&quot;),0,100);
  </code></pre>
  <p>The <code>let</code> keyword assigns x as a variable, but restricts it in <a href="https://www.w3schools.com/js/js_scope.asp" rel="nofollow noreferrer">scope</a> to the local expression, so that it doesn't possibly pollute other expressions.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-26T05:50:59.943Z
Answers.LastActivityDate: 2021-01-26T05:50:59.943Z
Answers.UserDisplayName: stib
Body: <p>I have a shape layer and I want to animate position x using this expression</p>
  <pre><code>x=clamp(thisComp.layer(&quot;Control Values&quot;).effect(&quot;Value Bar 1&quot;)(&quot;Slider&quot;),0,100);
  
  Math.round(easeOut(time,inPoint+0.53,inPoint+1.8, 0, x))
  [x, value[0]]
  </code></pre>
  <p>but he shows expression result must be of dimension 2. not 1
  <a href="https://i.sstatic.net/VW9v2.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/VW9v2.png" alt="enter image description here" /></a></p>
  <p>where is the problem???</p>
  
Tags: <after-effects><after-effects-expressions>
Title: How to using Math.round(easeOut(time…) in after affects?
UserDisplayName: joud desing
ThreadText: # How to using Math.round(easeOut(time…) in after affects?
  
  (Asked by: username_0 on 2021-01-21)
  
  I have a shape layer and I want to animate position x using this expression
  
  ```
  x=clamp(thisComp.layer("Control Values").effect("Value Bar 1")("Slider"),0,100);
  
  Math.round(easeOut(time,inPoint+0.53,inPoint+1.8, 0, x))
  [x, value[0]]
  
  ```
  
  but he shows expression result must be of dimension 2. not 1
  [![enter image description here](https://i.sstatic.net/VW9v2.png)](https://i.sstatic.net/VW9v2.png)
  
  where is the problem???
  
  **Tags:** after-effects, after-effects-expressions
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-01-26. Score: 1
  
  On the second line: `Math.round(easeOut(time,inPoint+0.53,inPoint+1.8, 0, x))` returns a value. Since expressions use the first line that returns a value as the value of the property it is trying to use the result of that line as the value for position, and since it only has one dimension it's causing an error.
  
  Change that line to
  
  ```
  x = Math.round(easeOut(time,inPoint+0.53,inPoint+1.8, 0, x));
  
  ```
  
  (don't forget the semicolon at the end).
  
  What the amended line is doing is taking the result of the `Math.round()` function and updating the value of x with that result.
  
  Just as best practice, you should also use a `let` on the first line, i.e.
  
  ```
  let x = clamp(thisComp.layer("Control Values").effect("Value Bar 1")("Slider"),0,100);
  
  ```
  
  The `let` keyword assigns x as a variable, but restricts it in [scope](https://www.w3schools.com/js/js_scope.asp) to the local expression, so that it doesn't possibly pollute other expressions.
  
  
  ---
  
  