Skip to main content
Inspiring
Dec 3, 2025 11:19 AM UTC
Question

Plz help me understand this error in expression

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?

 

867535i9DFE3892C5EA81A4.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?

 

867536i82D960C3C145A7A4.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.

867537i100676655F6CEF6C.png

 

5 replies

ShiveringCactus
Community Expert
Community Expert
Dec 3, 2025 12:58 PM UTC

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
Inspiring
Dec 3, 2025 1:27 PM UTC

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
Dan Ebberts
Community Expert
Community Expert
Dec 3, 2025 3:24 PM UTC

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