Body: <p>I have set up a pretty simple expression that animates the number of copies of a shape layers' repeater:</p>
  <pre><code>copies = 14;
  anim_start= 12;
  anim_end = 32;
  
  ftime = timeToFrames(time,25);
  if(ftime&lt;anim_end) 
  x =linear(ftime,anim_start,anim_end,0,copies);
  else 
  x = linear(ftime,225,243,copies,0);
  x;
  
  </code></pre>
  <p>It works fine if I replace &quot;anim_end&quot; with a number, but what it does now is have 0 copies at frame 11, and 14 copies one frame later. I am confused why AE won't exept my variable &quot;anim_end&quot;. Can someone point me in the right direction?</p>
  <p>thanks,
  Barbara</p>
  <p>edit: since I can't comment on the answer that was already given: putting { brackets in the if-else clause did not change anything, unfortunately. Thanks anyway :)</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-08-07T09:39:36.713Z
Comments.Text: Try putting the clauses of the `if … else …` expression in `{braces}`.
Comments.UserDisplayName: stib
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-08-17T15:07:58.067Z
Comments.Text: @Barbara - We can merge the two accounts you currently have, if you like, then you will be able to comment. At the moment it looks like you just created 2 accounts by accident.
Comments.UserDisplayName: Dr Mayhem
Tags: <after-effects-expressions>
Title: AE linear() function is not working with variable
UserDisplayName: Barbara
ThreadText: # AE linear() function is not working with variable
  
  (Asked by: username_0 on 2020-08-05)
  
  I have set up a pretty simple expression that animates the number of copies of a shape layers' repeater:
  
  ```
  copies = 14;
  anim_start= 12;
  anim_end = 32;
  
  ftime = timeToFrames(time,25);
  if(ftime<anim_end) 
  x =linear(ftime,anim_start,anim_end,0,copies);
  else 
  x = linear(ftime,225,243,copies,0);
  x;
  
  ```
  
  It works fine if I replace "anim\_end" with a number, but what it does now is have 0 copies at frame 11, and 14 copies one frame later. I am confused why AE won't exept my variable "anim\_end". Can someone point me in the right direction?
  
  thanks,
  username_0
  
  edit: since I can't comment on the answer that was already given: putting { brackets in the if-else clause did not change anything, unfortunately. Thanks anyway :)
  
  **Tags:** after-effects-expressions
  
  > **Comments:**
  > **username_1**: Try putting the clauses of the `if … else …` expression in `{braces}`.  
  > **username_2**: @username_0 - We can merge the two accounts you currently have, if you like, then you will be able to comment. At the moment it looks like you just created 2 accounts by accident.  
  
  ---
  
  ## 0 answers
  
  