Skip to main content
Participant
September 30, 2021
Question

Error: ab.normalOnPath() is not a function

  • September 30, 2021
  • 2 replies
  • 301 views

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)]
)

 

This topic has been closed for replies.

2 replies

Dan Ebberts
Community Expert
Community Expert
September 30, 2021

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...

 

 

 

Mylenium
Legend
September 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