Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Accesing 1st and 2nd keyframe of a mask from selected layer

  • Accesing 1st and 2nd keyframe of a mask from selected layer

    Posted by Tom Pinnes on December 30, 2020 at 4:14 pm

    Hello everyone i just started scripting with ExtendScript ToolKit and i’m in need of some direction.

    I’m trying to write a script that collects the vertices of a mask from the 1st keyframe and 2nd keyframe.

    *Assume the layer is selected and a layer holds at least 2 keyframes and is a rectangle.

    Here is my code so far, it’s lacking the most important part and this is where i need your help 🙂

     

    var project = app.project

    var currentComp = project.activeItem

    var selectedLayers = currentComp.selectedLayers

    var myLayer = selectedLayers[0]

    var layerIn = myLayer.inPoint

    var layerOut = myLayer.outPoint

    var selectedMask = myLayer.Masks(“Mask”)

    var newMaskShape = selectedMask.property(“maskShape”)

    var newShape = newMaskShape.value

    var shapeVert = newShape.vertices

    /// Find a way to select 2nd keyframe vertices

     

     

    Thanks in advance !

    Tom Pinnes replied 5 years, 8 months ago 2 Members · 2 Replies
  • 2 Replies
  • Walter Soyka

    December 31, 2020 at 3:27 pm

    Don’t forget semi-colons to end your statements.

    I modified your code a bit. Here’s how I’d get those vertices:

    var project = app.project;

    var currentComp = project.activeItem;

    var selectedLayers = currentComp.selectedLayers;

    var myLayer = selectedLayers[0];

    var layerIn = myLayer.inPoint;

    var layerOut = myLayer.outPoint;

    var maskPathProp = myLayer.mask("Mask 1").maskPath;

    var vertices1 = maskPathProp.keyValue(1).vertices;

    var vertices2 = maskPathProp.keyValue(2).vertices;

    alert(vertices1);

    alert(vertices2);

  • Tom Pinnes

    December 31, 2020 at 3:41 pm

    Hey Walter thanks for putting the time to help me!

    Yeah i forgot about the semi-colons.. Also this is more elegant than my code, i’m going to use it.

    Thanks

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy