Forum Replies Created

Page 20 of 65
  • You never assign a new value to your layer. Try this

    var myLayers = app.project.activeItem.selectedLayers;
    var firstLayer = myLayers[0];
    var secondLayer = myLayers[1];
    moveButton.onClick = function () {
    secondLayer.moveBefore(firstLayer);
    };
    createButton.onClick = function () {
    var newSolid = myComp.layers
    .addSolid([0.8, 0.2, 0.5], "NEW LAYER", 1920, 1080, 1)
    .moveBefore(app.project.activeItem.selectedLayers[0]);
    };
  • Andrei Popa

    January 18, 2021 at 9:19 am in reply to: try catch(err) for sourceRectAtTime expression

    You need to use an exception for when it’s zero because you can’t divide by 0. Try this

    R = sourceRectAtTime(sourceTime(time), true);

    w = R.width == 0 ? (thisComp.width / R.width) * 95 : 0;

    h = R.height == 0 ? (thisComp.height / R.height) * 60 : 0;

    s = Math.min(w, h);

    [s, s];

  • Can you share a cloud folder in which you got these 2 files?

  • You are adding the entire array each time, Try this instead on line 6

    pal.grp.groupTwo.asignGrid.add(“item”, sytleFull.layer(i).name);

  • I don’t think what you want is possible. The best way I can think of to do that would be to put a point control or 2 sliders on the text, and those 2 values would be the start character index/end character index of the highlight part.

    If you want to make this graphically visible with guide layers, I think you could put 2 squares or something at the top of the composition and get the indexes based on those 2 layers x-position. Basically, like a volume bar, but to control those values. You can divide the x position by 10 or something like that to make it easier to control(kind of lowering the sensitivity).

    You can also add an expression like the following one to those 2 layers to make sure they stay fixed on the y axis.

    yVal = 100;//200 for the other one

    [value[0],yVal]

  • Your graph is not here.

    I also think it would help if you could post the content of a json file to see exactly how that data is.

  • Andrei Popa

    January 12, 2021 at 8:08 am in reply to: Eliminate line breaks with regex!

    If you want to try an alternate solution, I would change the “based on” from the expression selector to “Words” and use this expression. It’s a bit simpler and also works if your text contains “~”

    txt = text.sourceText.replace(/\r/g,” “).split(” “);

    word = thisComp.layer(“word”).text.sourceText;

    if(txt[textIndex-1] == word) {100} else {0}

  • You can only change the style of the entire text layer as far as I know.

  • The autoleading value is 1.2. And sometimes when leading was different value but then set to autoleading, the expression took the value before the autoleading. So I have put that condition. If autoleading is true, than leading is fontsize*1.2

  • Andrei Popa

    October 28, 2020 at 5:27 pm in reply to: Set the auto leading by script.

    Adding to the expression may be the only way. Some texts have complicated expressions and not that easy to modify but I’ll have to give it a try.

    I think the best solution would be to put the value on the last row in every expression. Then the script could split the expression, get the last row and put it into something like style.setText(“last row”).setAutoLeading(true).

    Thanks for the suggestion.

Page 20 of 65

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