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

Can't use an old expression in After effects 2022

New Here ,
Nov 16, 2021 Nov 16, 2021

Copy link to clipboard

Copied

I used this code a while ago with Ae2019

Now I'm trying to use in Ae2022 but it says "Couldn't turn result into numeric value"
What do I need to change?

 

This is the expression:

(line with error angle=controlAngle+offset;)

layerCount=thisComp.numbLayers;
objectCount=layerCount-thisComp.layer("Control").index;
objectIndex=index-thisComp.layer("Control").index;

radius=thisComp.layer("Control").effect("Radius")("Slider");
controlAngle=thisComp.layer("Control").effect("Caroussel Angle")("Angle");
offset=360/(objectCount)*objectIndex;
angle=controlAngle+offset;

x=radius*Math.cos(degreesToRadians(angle))
y=0;
z=radius*Math.sin(degreesToRadians(angle))
centre=thisComp.layer("Control").toWorld([0,0,0]);
add(centre,[x,y,z])

 

TOPICS
Error or problem , Expressions , How to , Scripting

Views

268

Translate

Translate

Report

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 ,
Nov 16, 2021 Nov 16, 2021

Copy link to clipboard

Copied

For starters, the first line should be:

layerCount = thisComp.numLayers;

Votes

Translate

Translate

Report

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 ,
Nov 17, 2021 Nov 17, 2021

Copy link to clipboard

Copied

LATEST

It's difficult to see without the fullo comp and Dan's right about the error in line 1, although that doesn't explain the issue wit the line:

angle=controlAngle+offset;

Has your project reverted to Legacy ExtendScript?  You can check this in File > project settings

 

When I'm debugging expressions, I'll create a text layer and add each line in turn to the sourcetext.  The error is suggest AE cannot get a number, so see what the code is failing to turn into a number.

 

Votes

Translate

Translate

Report

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