Skip to main content
Participant
May 3, 2019
Question

Trouble with Rotation Expression

  • May 3, 2019
  • 1 reply
  • 451 views

Hi, I'm having trouble with the error: "Undefined value used in expression (could be an out of range array subject?) on line 1.

Here's the expression:

m = index-2;

d = thisComp.layer("Controller").effect("Delay")("Slider");

x = thisComp.layer("Shape Layer 200").transform.xRotation.valueAtTime(time-d*m);

[x[0]]

new to expressions and so i'm not sure what i do and don't need. I'm basically following the rotation of the shape layer above with a slight delay from the "Controller" slider.

I've used index -2 as I will be copying this do the layers below so that they are offset a little more each time.

Thanks for any and all help.

This topic has been closed for replies.

1 reply

Kyle Hamrick
Community Expert
Community Expert
May 3, 2019

Rotation only has one value, so you can kill the [0] in that last line.

Honestly, you don't really need the last line at all, and could just remove the variable from the third line and use that as your actual function.

Participant
May 3, 2019

Thanks, works now. though I'm still unsure why it wouldn't work before.

So with most expressions the final line is the function and I only need [value(0)] [value(1)] etc. if there are multiple values?

Kyle Hamrick
Community Expert
Community Expert
May 3, 2019

Correct. Properties like Position or Scale that contain multiple values must use what's called an array. Single-value properties don't require them.
Here's a good explanation of arrays and how to use them.
After Effects Expressions 303 - Arrays - YouTube

(This entire series is excellent, and I would highly recommend it for your expressions learning!)