Forum Replies Created

Page 11 of 65
  • You can create another invisible layer that contains only your big word. Then, on the start and end of the animator you can put

    w = thisComp.layer("big word").text.sourceText.replace(/\r/g,"");
    text.sourceText.replace(/\r/g,"").indexOf(w);

    and

    w = thisComp.layer("big word").text.sourceText.replace(/\r/g,"");
    text.sourceText.replace(/\r/g,"").indexOf(w)+w.length;

    This will update each time you change the big word

  • Hi Constanti.

    I am not 100% sure how the paths are organized inside your layer, but this or something close to this should work.

    var myComp = app.project.activeItem;
    var mySourceLayer = myComp.layer("de sters");
    var myDestLayer = myComp.layer("1");
    for (var i = 1; i <= mySourceLayer("Contents").numProperties; i++) {
    var myPath = mySourceLayer("Contents")(i)("Path") ;
    if(myPath !== null) copyPathToMask(mySourceLayer, myPath, myDestLayer);
    }
    function copyPathToMask(mySourceLayer, myPath, myDestLayer) {
    mySourceLayer.selected = true;
    myPath.selected = true;
    app.executeCommand(18); //Cut
    mySourceLayer.selected = false;
    var myNewMask = myDestLayer.property("Masks").addProperty("Mask");
    var myNewPath = myNewMask.property("Mask Path");
    myDestLayer.selected = true;
    myNewMask.selected = true;
    myNewPath.selected = true;
    app.executeCommand(20); //Paste
    myDestLayer.selected = false;
    }

  • I think you can do that with an animator on position.

    So add an animator for position, set the range “units” to “index” and the “based on” to “characters”. Then set the start to the position of the first letter of the word and the end to the position of the last letter of the word. I made another composition in your project to show you what I mean.

  • About the errors: the post is old, and when the forum changed, some texts got reformated. Your errors are probably because most quotes are different.

    About the expression not working.

    You probably have a paragraph text, and not a point text. In order to ignore the empty parts of the paragraph text, you should use sourceRectAtTime with the second argument as false.

    // right edge
    gap = 10;
    L = thisComp.layer("some text");
    r = L.sourceRectAtTime(0,false);
    x = L.position[0] + (r.left + r.width - L.anchorPoint[0])*L.scale[0]/100 + scale[0]*width/200 + gap;
    [x, value[1]]
  • Andrei Popa

    November 30, 2021 at 8:48 am in reply to: Add a loop after a if?

    Hi Ricardo.

    If you have only 2 keyframes, this should work.

    d = 2;
    t1 = key(1).time;
    t2 = key(2).time;
    x = valueAtTime(((time - t1) % 2) + t1)[0];
    m = d == 2 ? linear(x, -50, 50, 0, 50) : x;
    [m, 0];

    If you have more keyframes, you should change the values for t1 and t2 to be the time of the second-last and last keyframes.

    I modified your if statement into a ternary operator for faster execution.

  • Andrei Popa

    November 29, 2021 at 4:18 pm in reply to: Expression for identical Text and Line length

    Hi Kristy. I am not sure what you want to achieve. Can you explain a little more detailed? Maybe post a picture.

  • Andrei Popa

    November 24, 2021 at 9:22 am in reply to: find Y value of path at specific X value

    Hi Whitney. I think this should work better. It’s not 100% accurate, but more accurate than before. Basically, it checks for every percent if it passed the center of the current rectangle. When it passed, it returns the value. It will work bad if you have loops in your shape, but if it is similar to the example, it should work

    myPathLayer = thisComp.layer("Path");

    myPath = thisComp.layer("Path").content("Path 1").path;

    startPosition = myPath.pointOnPath(0);

    arbitraryX = xPosition + startPosition[0];

    i = 1;

    while (startPosition[0] < arbitraryX) {

    startPosition = myPath.pointOnPath(i / 100);

    i++;

    }

    startPosition[1] + myPathLayer.position[1];

  • Andrei Popa

    November 12, 2021 at 6:45 am in reply to: If (true) set value for next 4 frames

    Hi Jeremy. Expressions can’t modify values in other places than the property on which they are applied, for the current frame. But for your case there is a workaround. You can evaluate the statement for the previous 3 frames, and if it’s true, make opacity 100. I imagine your statement checks the value of a property in the project, so you can use .valueAtTime() .

    Something like:

    durationCheck = 4;
    st = false;
    for(i = 0; i<durationCheck; i++){
    if( statement.valueAtTime(time-framesToTime(durationCheck)) == true ) st = true;
    }
    st == true ? 100 : 0;
  • Andrei Popa

    November 12, 2021 at 6:38 am in reply to: Self resizing text box, alter width

    Hi Nina.

    In your expression row 2 is width and row 3 is height. Just add the amount of pixels you need to each row, like this:

    s = thisComp.layer("svo");
    w = s.sourceRectAtTime().width + 50;
    h = s.sourceRectAtTime().height + 20;
    [w,h]
  • Andrei Popa

    November 10, 2021 at 4:09 pm in reply to: If/Else expression referencing contents of thisComp.ame

    Hi Sami.

    I think what you need is this:

    if (thisComp.name.indexOf("Careful Close") != -1) {100}
    else {0}
Page 11 of 65

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