Skip to content

Instantly share code, notes, and snippets.

@dokluch
Created February 11, 2014 06:08
Show Gist options
  • Save dokluch/8929977 to your computer and use it in GitHub Desktop.
Save dokluch/8929977 to your computer and use it in GitHub Desktop.
Get vertices and tangents info for a selected layer's first mask in AE
//get all first mas vertices info
//Nik Ska, 2014
//CC-BY
var maskVertex = function(v, inT, outT){
this.vertex = v;
this.inTangent = inT;
this.outTangent = outT;
this.showInfo = function(){
$.writeln("\nCoordinate: ", this.vertex);
$.writeln("\tinTangent: ", this.inTangent);
$.writeln("\toutTangent: ", this.outTangent);
}
}
getVertices = function(layer){
var tmp = layer.property("ADBE Mask Parade").property("ADBE Mask Atom").property("ADBE Mask Shape").value;
var mask = [];
if(tmp){
for(var v = 0; v < tmp.vertices.length; v++){
mask.push(new maskVertex(tmp.vertices[v], tmp.inTangents[v], tmp.outTangents[v]));
}
return mask
}
return null;
}
var activeComp = app.project.activeItem;
if(activeComp && activeComp instanceof CompItem){
var sel = activeComp.selectedLayers;
if(sel && sel.length > 0){
var mask = getVertices(sel[0]);
for(var m = 0; m < mask.length; m++){
mask[m].showInfo();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment