Forum Replies Created

Page 60 of 1081
  • See if this works for you:

    var comp = app.project.activeItem; // Get active composition
    if(comp) {
    if(comp.markerProperty.numKeys > 0) {
    var markers = comp.markerProperty; // Get markers
    var frameDuration = comp.frameDuration; // Get composition frame duration
    for (var i = 1; i <= markers.numKeys; i++) {
    var curMarker = markers.keyValue(i);
    var markerTime = markers.keyTime(i); // Get marker time
    var closestFrame = Math.round(markerTime / frameDuration)*frameDuration; // Get closest frame
    markers.removeKey(i);
    markers.setValueAtTime(closestFrame,curMarker);
    }
    } else {
    alert("The active composition does not have any markers.");
    }
    } else {
    alert("No active composition.");
    }


  • Like this maybe:

    var shapeLayer = app.project.activeItem.selectedLayers[0];
    var props = shapeLayer.selectedProperties;
    for (var i = 0; i < props.length; i++){
    if (props[i].matchName == "ADBE Vector Shape"){
    // do stuff
    }
    }
  • Dan Ebberts

    January 11, 2023 at 7:11 pm in reply to: Concatenate the texts and the styles

    Your expression won’t be able to apply multiple styles to one text layer. You can concatenate the text, but all characters will end up with the same style.

  • Come back if you have questions.

  • Dan Ebberts

    January 10, 2023 at 8:20 pm in reply to: update all label colors

    As far as I know, labels for render queue items aren’t accessible to scripting, and I don’t know how else you would do it.

  • If you could format your data as a .csv file, you could import that and drag it into the timeline. When you do that, it generates a data element called “Number of Rows” which could drive the number of points on your graph. I think you could ditch the nulls and have a path expression for your line that would create the path points directly from the data in the .csv. A bit of work and design, but do-able, I think. Then you just replace the .csv file with a new data set and the line should adjust. The details would depend on the specific requirements of your graph.

  • Normally you would use the negative time trick to have a property make its pre-expression value available to other properties where they could use valueAtTime() with a negative number. However, in this case that wasn’t necessary because the pre-expression value is still available from the Input Text layer, so it was an unnecessary extra level of complexity.

  • <div>In getting ready to write up a little explanation for the expressions, I realized that I made them way more complicated than they needed to be. The first one could be simplified to this:</div>

    txt = thisComp.layer("Input Text").text.sourceText;
    txt.replace(/[\[\]']+/g,'');

    which just grabs the input text and applies a Regular Expression to remove the bracket characters.

    The second one could be simplified to this:

    txt = thisComp.layer("Input Text").text.sourceText;
    idx = textIndex - 1;
    txt.split(" ")[idx].indexOf("[") == 0 ? 100 : 0

    which just checks each word of the input text to see if it starts with “[” and if so, applies the fill color.

  • <div>On your output layer, add this expression for Source Text:</div>

    txt = thisComp.layer("Input Text").text.sourceText;
    if (time < 0)
    txt
    else
    txt.replace(/[\[\]']+/g,'');

    Add a Fill Color Animator, add an Expression Selector, delete the Range Selector, set the Expression Selector’s “Based On” parameter to “Words”, and apply this expression for Amount:

    txt = text.sourceText.valueAtTime(-1);
    idx = textIndex - 1;
    txt.split(" ")[idx].indexOf("[") > -1 ? 100 : 0

    Add this expression to the Fill Color:

    hexToRgb(thisComp.layer("Input Color:").text.sourceText.value)

    Note this this will remove all square brackets from the text, but only requires that a word start with [ to get the fill color applied. You could require both [ and ] brackets, but that would be a little more complex.

  • The colors need to be floating point values between 0 and 1. I’d do it like this:

    n = parseInt(thisComp.name)%3;
    if (n == 0)
    [1,1,1,1]
    else if (n == 1)
    [0,0,0,1]
    else
    [.5,.5,.5,1];
Page 60 of 1081

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