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

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

New Here ,
Apr 22, 2024 Apr 22, 2024

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

TOPICS
Expressions
752
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 ,
Apr 22, 2024 Apr 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. 

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 ,
Apr 22, 2024 Apr 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.

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
New Here ,
Apr 22, 2024 Apr 22, 2024

Screenshot 2024-04-22 155550.png

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 

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
New Here ,
Apr 22, 2024 Apr 22, 2024

Giovanni0D4C_0-1713798192362.png

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

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 ,
Apr 22, 2024 Apr 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.

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
New Here ,
Apr 22, 2024 Apr 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)

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 ,
Apr 22, 2024 Apr 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.

 

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 ,
Apr 22, 2024 Apr 22, 2024
LATEST

I took a look at your project. If you delete all the layers but the top 10 from "stars bg rotation" and "stars bg rotation exp" the expression errors go away. 

 

You've created a recursive set of expressions that are overwhelming the calculations and causing an error. The error message that the property requires two arguments is odd, but tying about 140 layers together with each one looking at a property in the layer above and offsetting it by a time value is causing a mess. 

 

I think you are trying to create a comp that has multiple rows of rotating stars that start at the bottom. A more efficient approach would be to create the bottom row only as a comp that is only one row high and make the stars rotate in order as your first row does. When you have that done, drag the single row of rotating stars comp into the big main comp and use Time Remapping to offset the playback or just sequence the layers.

 

You might even consider rendering a "high quality lossless with alpha" copy of the single-row comp of rotating stars, adding the render to the main comp, and sequencing the layers to create your star background. Doing that will give you a comp that will render almost in real-time.

 

Take a look at the modified comp.  I'm not sure you'll get the desired result because the anchor point is not centered on the star.

RickGerard_0-1713806813510.gif

 

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