Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

- Home
- >
- After Effects
- >
- AE expression error (can't find solution in forum)

Participant
,

Apr 25, 2020

Copy link to clipboard

Copied

I know very little about AE and am not delusional about being able to learn it all quickly. That's why I'm grateful for a site I found with the expressions I needed to just copy and paste. Their Wiggle expression worked great, but I'm having trouble with their Squash and Stretch expression. Here is what they provide, copied and pasted exactly:

```
maxDev = 13; // max deviation in pixels
spd = 30; //speed of oscillation
decay = 1.0; //how fast it slows down
t = time - inPoint;
x = scale[0] + maxDev*Math.sin(spd*t)/Math.exp(decay*t);
y = scale[0]*scale[1]/x;
```

See the screenshot for the error I'm getting:

I have searched this forum already, and plenty of new users have seen this error. The common solutions I've read so far are:

- Use "square" brackets instead of parentheses, but... there aren't any parentheses at all in Line 1. ??? (I've tried, for fun, inserting brackets in various ways to see if something worked or blew up. Neither.)
- The expression is full of typos. This may well be the case, I'd have no way of knowing, not really understanding what the expression means. Like I said, I'm grateful for copy and paste at this point, until I can learn what I need as I go. I did notice that in Line 1, there is an extra space before the word max, after the two slashes. I tried deleting it but it made no difference.

I also read somewhere that the expression engine has changed, and expressions that used to work no longer do. I suspect this is the problem. The page I copied the expression from was written in 2017, and I'm using the latest AE (updated approximately a week ago). I have a feeling this expression used to work and doesn't anymore.

Can anyone help me fix it? Thanks in advance!

You left off the last line:

```
maxDev = 13; // max deviation in pixels
spd = 30; //speed of oscillation
decay = 1.0; //how fast it slows down
t = time - inPoint;
x = scale[0] + maxDev*Math.sin(spd*t)/Math.exp(decay*t);
y = scale[0]*scale[1]/x;
[x,y]
```

TOPICS

Error or problem,
Expressions,
Scripting

Community Guidelines

Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Participant
,

Apr 25, 2020

Copy link to clipboard

Copied

I know very little about AE and am not delusional about being able to learn it all quickly. That's why I'm grateful for a site I found with the expressions I needed to just copy and paste. Their Wiggle expression worked great, but I'm having trouble with their Squash and Stretch expression. Here is what they provide, copied and pasted exactly:

```
maxDev = 13; // max deviation in pixels
spd = 30; //speed of oscillation
decay = 1.0; //how fast it slows down
t = time - inPoint;
x = scale[0] + maxDev*Math.sin(spd*t)/Math.exp(decay*t);
y = scale[0]*scale[1]/x;
```

See the screenshot for the error I'm getting:

I have searched this forum already, and plenty of new users have seen this error. The common solutions I've read so far are:

- Use "square" brackets instead of parentheses, but... there aren't any parentheses at all in Line 1. ??? (I've tried, for fun, inserting brackets in various ways to see if something worked or blew up. Neither.)
- The expression is full of typos. This may well be the case, I'd have no way of knowing, not really understanding what the expression means. Like I said, I'm grateful for copy and paste at this point, until I can learn what I need as I go. I did notice that in Line 1, there is an extra space before the word max, after the two slashes. I tried deleting it but it made no difference.

I also read somewhere that the expression engine has changed, and expressions that used to work no longer do. I suspect this is the problem. The page I copied the expression from was written in 2017, and I'm using the latest AE (updated approximately a week ago). I have a feeling this expression used to work and doesn't anymore.

Can anyone help me fix it? Thanks in advance!

You left off the last line:

```
maxDev = 13; // max deviation in pixels
spd = 30; //speed of oscillation
decay = 1.0; //how fast it slows down
t = time - inPoint;
x = scale[0] + maxDev*Math.sin(spd*t)/Math.exp(decay*t);
y = scale[0]*scale[1]/x;
[x,y]
```

TOPICS

Error or problem,
Expressions,
Scripting

Community Guidelines

Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

jampff

Apr 25, 2020
0
/t5/after-effects/ae-expression-error-can-t-find-solution-in-forum/td-p/11079812
5
Replies
5

Guide
,

Apr 25, 2020

Copy link to clipboard

Copied

You left off the last line:

```
maxDev = 13; // max deviation in pixels
spd = 30; //speed of oscillation
decay = 1.0; //how fast it slows down
t = time - inPoint;
x = scale[0] + maxDev*Math.sin(spd*t)/Math.exp(decay*t);
y = scale[0]*scale[1]/x;
[x,y]
```

Community Guidelines

Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Reply

Loading...

Dan Ebberts

Apr 25, 2020
0
/t5/after-effects/ae-expression-error-can-t-find-solution-in-forum/m-p/11079842#M110137
Participant
,

Apr 25, 2020

Copy link to clipboard

Copied

Astounding! Thank you so much! That worked like a charm. I would have had NO WAY of knowing that was the issue in my present state of ignorance (which as of reading your reply is sliiiiiiightly less ignorant). I suppose I was barking up the wrong tree, because AE said an error was in Line 1. I am interested in learning what all of this means of course but that will take time.

Just curious, would this expression have worked before, in previous versions of AE? Because I checked the source, and I didn't accidentally leave out the line... the way I copied it is in fact the way they posted it... see screenshot:

They didn't include the last line either. So perhaps it used to work without it?

And, I'm assuming you're "the famous" Dan Ebberts... if so, I'm privileged to have you answer my question. Thank you again!

Community Guidelines

Reply

Loading...

jampff

Apr 25, 2020
0
/t5/after-effects/ae-expression-error-can-t-find-solution-in-forum/m-p/11080007#M110142
Guide
,

Apr 25, 2020

Copy link to clipboard

Copied

I don't know about famous, but I can tell you that I believe that expression originally came from an old page on my site:

https://www.motionscript.com/expressions-lab-ae65/squash-and-stretch.html

where the last line is present, as it needs to be.

It seems that the new JavaScript engine does sometimes mistakenly point to line 1 for errors. I've filed a couple of bug reports on it, but as far as I know, it hasn't been fixed yet.

Dan

Community Guidelines

Reply

Loading...

Dan Ebberts

Apr 25, 2020
0
/t5/after-effects/ae-expression-error-can-t-find-solution-in-forum/m-p/11080034#M110143
Guide
,

Apr 25, 2020

Copy link to clipboard

Copied

The expression - without the last line - was never working this way in no version of AE.

In JavaScript as well as in ExtendScript, the last value written or calulated is the one in use. Even if you calculate x and y in the lines above, you must enter [x,y] in order to "present" the values.

Can you post the link to the source of this expression site?

There are a lot of copy/past code snippets out there from people how have no glue of what they are talking about. So it's importend to have some "trustful" sites to check, like https://www.aenhancers.com/ and of course the famous Dan Ebberts https://motionscript.com/

I learned a lot about expressions from the language reference (https://helpx.adobe.com/after-effects/using/expression-language-reference.html), as well as code snippets. I never just copy/paste them, but always went through the lines and understand what is going on there. Spent a whole afternoon once just to understand 4 lines from Mr. Ebberts, but it was worth the time.

After Effects is not very good in pointing you to the actual line, or even give you meaningful expression errors. Sometimes you just miss an ";" and it tells you something about "arrays out of index".

*Martin

Community Guidelines

Reply

Loading...

Martin_Ritter

Apr 25, 2020
0
/t5/after-effects/ae-expression-error-can-t-find-solution-in-forum/m-p/11080087#M110148
jampff
LATEST

Participant
,

Apr 25, 2020

Copy link to clipboard

Copied

Oh man oh man. Mr. Ebberts, they most certainly took that from your site. There's no way they didn't. But they should have made sure it was complete. Personally, I think it would have been more professional of them to link to you instead of just copy your expression.

I found it at https://www.cinecom.net/after-effects-tutorials/super-easy-animations-expressions/. The young guys who run this site are super enthusiastic and they do know a lot of cool tricks... I think ? that's their full-time business. But yeah, they should have just linked to you instead.

Thank you, Martin, for your insights and links as well. This is all very enlightening. I think I'm going to head to those links from now on right away, instead of "googling" expressions I need.

Community Guidelines

Reply

Loading...

jampff

Apr 25, 2020
0
/t5/after-effects/ae-expression-error-can-t-find-solution-in-forum/m-p/11080135#M110152
Resources

Troubleshooting FAQs

After Effects Community Recap

Getting started with After Effects

Using the Community
Experience League
Terms of Use
Privacy Policy
Cookie preferences
AdChoices
Language:

- Deutsch
- English
- Español
- Français
- 日本語コミュニティ
- Português

Copyright © 2020 Adobe. All rights reserved.