Skip to main content
Participant
April 22, 2024
Question

add() needs exactly two arguments. Is this a bug or...?

  • April 22, 2024
  • 5 replies
  • 874 views

thisComp.layer(index-1).transform.rotation.valueAtTime(time-.1)
thisComp.layer("Dark Blue Solid 1").transform.rotation

.

.

both the above expressions come back with : "Error: add() needs exactly two arguments"

 

Is this a bug or? Literally can't see anything wrong with the above expressions

This topic has been closed for replies.

5 replies

Participant
April 22, 2024

Well interestingly it shows the error for the two properties with the expressions for all layers as soon as I twirl down the little arrow by the stopwatch button. The expression featuring the (index-1) part goes on for quite a bit to be fair, about 100 layers or so.

I am attaching the project file.
I also went checking for updates for the computer I am currenly working on, and tried to reinstall the software (I didn't try reinstalling older Ae versions though)

Dan Ebberts
Community Expert
Community Expert
April 22, 2024

Long layer chains, using (index -1) to cascade your expressions, can really bring your processor to its knees. It's better if you can come up with a calculation based on the difference in the layer index between the current layer and the "leader" layer. I'm not sure this is exactly correct, but that would make your rotation expression (for all layers except Layer 1), something like this:

leader = thisComp.layer(1);
delay = (index - leader.index)*0.1;
leader.rotation.valueAtTime(time - delay)

You might try that (and a similar expression for scale) and see if that clears up your issues. BTW, when I switched your project to the legacy expression engine, the errors went away, but the performance was still really sluggish.

 

Participant
April 22, 2024

sorry here it is again, the expression in the interface was slightly cut off

Dan Ebberts
Community Expert
Community Expert
April 22, 2024

I don't get any errors when I try it. I assume layer 5 has the same expression (is that correct?), but it doesn't show an error. How long is your string of layers where you're using (index-1) to refer to the previous layer? At this point I'm stumped. It would help if you could post a project file that demonstrates the problem.

Participant
April 22, 2024

I'm really sorry I rushed and I realised I didn't attach any image with the query. here it is. I hope the image is clear enough 

Dan Ebberts
Community Expert
Community Expert
April 22, 2024

Are you showing us the whole expression? I wouldn't expect either of those lines to come back with exactly that error message.

Community Expert
April 22, 2024

Apply the expression to a single-value property like Rotation or Opacity, and you will not get that error. Apply that expression to a property that contains an array like Scale, and you will get that error.