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

Error: ab.normalOnPath() is not a function

New Here ,
Sep 30, 2021 Sep 30, 2021

Hi

 

I managed to a path with the following script (just a line between two layers), but trying to add a third point inbetween them with a slight offset AE does not find the normalOnPath function (trying to bend the line as if ther's a knee/elbow on it). Is it not available on a new createPath() variable?

 

var ab = createPath( 
[toWorld(effect("A")("Layer").position), 
toWorld(effect("B")("Layer").position)] 
)

createPath(
[toWorld(effect("A")("Layer").position),
ab.normalOnPath()*50,
toWorld(effect("B")("Layer").position)]
)

 

TOPICS
Error or problem , Expressions
222
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
LEGEND ,
Sep 30, 2021 Sep 30, 2021

It's a script function, not an expression. They are completely different things based on separate infrastructures and cannot be used interchangeably. For expressions you have to do all the calculations the hard way yourself.

 

Mylenium

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 ,
Sep 30, 2021 Sep 30, 2021
LATEST

That's interesting. Apparently you can't access the path you just created with the path functions (pointOnPath, normalOnPath, etc.). However, I was able to create one path with this:

L1 = effect("A")("Layer");
L2 = effect("B")("Layer");
p1 = fromComp(L1.toComp(L1.anchorPoint));
p2 = fromComp(L2.toComp(L2.anchorPoint));
createPath([p1,p2],[],[],false);

Then create another path (like you're after) by referencing the first one with this:

ab = content("Shape 1").content("Path 1").path;
p1 = ab.pointOnPath(0);
p3 = ab.pointOnPath(1);
p2 = ab.pointOnPath(.5) + ab.normalOnPath(.5)*50;
createPath([p1,p2,p3],[],[],false)

So I guess you could do that, then turn off visibility to the first one. I'm not sure if that helps...

 

 

 

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