Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Script mask shape to motion path

  • Benoit Kergosien

    March 25, 2015 at 11:40 am

    Found!

    var N=myLayer.property(“Effects”).numProperties; and not var N=myLayer.numProperties;

    Benoit

  • Benoit Kergosien

    April 18, 2015 at 7:19 pm

    Hi,

    Unfortunately I’ve got another problem :

    the path copied via my script isn’t as accurate than the one copied manually.

    See the image attached!

    my code:

    ==============================================

    var myComp=app.project.activeItem;
    var myLayer=myComp.selectedLayers[0];
    var myMask=myLayer.mask(1);
    var times=new Array();

    // Creation of Effects
    var mynumEffects=myLayer.property(“Effects”).numProperties;
    myLayer.property(“Effects”).addProperty(“Point Control”);

    // Customisation of Effects
    var Target=myLayer.property(“Effects”).property(mynumEffects+1);
    Target.name=”myTarget”;
    var myTarget=Target.property(“Point”);
    mynumEffects+=1;

    // Read path content
    var shape=myMask.maskPath.value,
    verts=shape.vertices,
    inTan=shape.inTangents,
    outTan=shape.outTangents,
    numVerts=verts.length;

    // In case of closed shape
    if (shape.closed) {verts.push(verts[0]); inTan.push(inTan[0]); outTan.push(outTan[0]); numVerts++;};

    /*
    // Inject 2D tangents into 3D property (tangents for a motion path always 3D, even for 2D)
    for (var k=0; k < numVerts; k++) inTan [k][2] = outTan[k][2] = 0;
    */

    // Interval of time within wich the animation is adapted
    var step = 2/(numVerts-1);
    for (k=0; k

Page 2 of 2

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