Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Changing the Trim Path style in a script?

  • Changing the Trim Path style in a script?

     Fabian Brugger updated 2 months ago 2 Members · 3 Posts
  • Fabian Brugger

    September 26, 2022 at 9:29 pm

    Hey, i am writing a script that makes keyframe and a trim path effect for multiple shape layers. I am almost done but can’t find a way to change the trim patch style from simultaneously, as its set by default, to individually. Is there any way?

    I tried it with this but didn’t work:

    var trimStyle = layers[i].property(“Contents”).property(1).property(“Contents”).property(“Trim Paths 1”).property(“ADBE Vector Trim Type”)

    trimStyle.addproperty(“Trim Multiple Shapes”)

    Any ideas?

    //My Script:

    var comp = app.project.activeItem;

    var layers = comp.selectedLayers;

    if (layers.length == 0) {

    alert(“You must select a layer”);

    } else {

    for (var i = 0; i < layers.length; i++) {

    if (layers[i] instanceof ShapeLayer) {

    var propertyOne = layers[i].property(“ADBE Root Vectors Group”).property(1).property(“ADBE Vectors Group”)

    propertyOne.addProperty(“ADBE Vector Filter – Trim”)

    var trimStart = layers[i].property(“Contents”).property(1).property(“Contents”).property(“Trim Paths 1”).property(“Start”);

    trimStart.setValueAtTime(0, 0);

    trimStart.setValueAtTime(2, 100);

    trimStart.setTemporalEaseAtKey(1, [ease1]);

    trimStart.setTemporalEaseAtKey(2, [ease1]);

    var trimEnd = layers[i].property(“Contents”).property(1).property(“Contents”).property(“Trim Paths 1”).property(“End”);

    trimEnd.setValueAtTime(0, 0);

    //tired it with this but doesnt work…

    //var trimStyle = layers[i].property(“Contents”).property(1).property(“Contents”).property(“Trim Paths 1”).property(“ADBE Vector Trim Type”)

    //trimStyle.addproperty(“Trim Multiple Shapes”)

    var propertyTwo = layers[i].property(“ADBE Root Vectors Group”).property(2).property(“ADBE Vector Transform Group”).property(“ADBE Vector Group Opacity”)

    propertyTwo.setValueAtTime(0, 0);

    propertyTwo.setValueAtTime(2, 20);

    propertyTwo.setTemporalEaseAtKey(1, [ease1]);

    propertyTwo.setTemporalEaseAtKey(2, [ease1]);

    var propertyThree = layers[i].property(“ADBE Root Vectors Group”).property(3).property(“ADBE Vector Transform Group”).property(“ADBE Vector Group Opacity”)

    propertyThree.setValueAtTime(0.8, 0);

    propertyThree.setValueAtTime(2, 100);

    propertyThree.setTemporalEaseAtKey(1, [ease1]);

    propertyThree.setTemporalEaseAtKey(2, [ease1]);

    }

    }

    }

  • Dan Ebberts

    September 27, 2022 at 12:04 am

    This quick test worked for me:

    app.project.activeItem.layer(1).property("ADBE Root Vectors Group").property("ADBE Vector Filter - Trim").property("ADBE Vector Trim Type").setValue(2);
  • Fabian Brugger

    September 27, 2022 at 8:53 am

    Thank you very much! It works.

    Also thank you for all the work you do on this forum! I red some posts of yours answering other people’s question and could learn from that!

Viewing 1 - 3 of 3 posts

Log in to reply.

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