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])
Copy link to clipboard
Copied
For starters, the first line should be:
layerCount = thisComp.numLayers;
Copy link to clipboard
Copied
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.