<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>

CC BY-SA 4.0
2020-08-07T09:39:36.713Z
Try putting the clauses of the `if … else …` expression in `{braces}`.
stib
CC BY-SA 4.0
2020-08-17T15:07:58.067Z
@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.
Dr Mayhem
<after-effects-expressions>
AE linear() function is not working with variable
Barbara
# 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
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

