0

Is it possible to get the position of a specific vertex of an After Effect shape ?

something like

var shape = parent.content("Shape 1").content("Path 1").path.value;
var vertexes = shape.vertices;
var startVertex = vertexes[0];

...

[x,y]

But this code does not work...

Thanks.

0

As of 2019 you can access a path of a shape or a mask like so:

myShape = thisComp.layer("Shape Layer 1").content("Shape 1").content("Path 1").path;

The path property is an object containing collections of points, inTangents and outTangents. It has three methods for obtaining the vertex details, points() returns the vertices, and inTangents() and outTangents() return the tangent handle positions if they have any. Each method optionally takes a time parameter to specify what time the data is retrieved. e.g.:

myPoints = myShape.points(); //you can optionally specify the time, e.g. .point(t=123)
myPoints[0]

myInTangents = myShape.inTangents();
myInTangents[0]

In addition there are other methods for getting an arbitrary point on a path not at a vertex, and for finding out if the path is closed. It's a world of fun! Read the docs here

  • that is wonderful ! thanks. – gordie Nov 15 at 8:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.