Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Plz help me understand this error in expression

Contributor ,
Dec 03, 2025 Dec 03, 2025

In a linked in learning course, there was this example expression... 

 

It wasn't really explained well... the syntax for the b variable of the array index ([1]) on the wiggle function perhaps just shows my lack of javascript (?) familiarity.. but can someone explain how this index on the scale property is being 'used' by the wiggle function?

 

2025-12-03_05-12-15.png

 

Perhaps asking a slightly different way... why does removing the array index ([1]) from the wiggle function cause an error on the FIRST line of code?

 

DoYouLikeHam_0-1764760576264.png

while omitting that b= assignment statement altogether resolves the error?  It seems counter intuitive for modification in the second line like above to cause an error to the first line, and I'd like to understand what is going on so if/when I encounter other errors, I have a better understanding of how the system as a whole is functioning.

DoYouLikeHam_1-1764760690210.png

 

TOPICS
Error or problem , Expressions
97
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 03, 2025 Dec 03, 2025

Properties in After Effects that have two values, for example scale height and scale width, use an array in expressions.

in the expression you have:

  • a is being set as the width value of the scale property
  • b is using a wiggle, based on the value, to vary the current scale values twice per second (2) by up to 50%.  But as wiggle produces an array, the expression takes the second value, which corresponds to the scale height  [1].
  • c then sets the scale width to be a and the scale height to be b.

 

So by removing the [1], you're setting the scale to be [a,[50,50]] which is an array too far.   

Hope that makes sense

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 03, 2025 Dec 03, 2025

I think that makes sense... but doesn't help me understand why it tells me the error is in line 1, where I'm assigning the value of 'a' w/ array index [0].

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 03, 2025 Dec 03, 2025

The error message is incorrect and not very helpful. Sometimes you can get better/more info by temporarily switching to the Legacy ExtendScript expression engine (File > Project Settings > Expressions), but in this case it will tell you that the error is in line 0.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 08, 2025 Dec 08, 2025

Do you mean that the legcy engine will tell me the error is in line 0.. which is equally unhelpful?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 08, 2025 Dec 08, 2025
LATEST

Yes, in this case, using the legacy engine doesn't help. It's actually becoming less and less useful as a debugging tool because you have to avoid using new features of the language which aren't supported by the legacy engine. Dealing with the error messages from the new engine can be frustrating - especially the situation where, with a large expression, you might get an error with a reported line number beyond the end of the expression. I do wish they'd fix that...

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