Forum Replies Created

Page 21 of 65
  • Just in case someone still needs this today.

    I needed to count the lines, stumbled on this solution and noticed some things were added by Adobe to after effects in the meantime.

    I tried this solution and it worked perfectly with any type of font/fontsize/leading.

    L = thisComp.layer("Text Layer");

    var newStyle = L.text.sourceText.style;

    var myLeading = newStyle.autoLeading ? newStyle.fontSize * 1.2 : newStyle.leading;

    H = L.sourceRectAtTime(time, false).height;

    rowNo = Math.ceil(H / myLeading);

    rowNo;

    You may need to replace the first row with a link to your actual text layer.

  • Andrei Popa

    October 8, 2020 at 7:55 am in reply to: Set the auto leading by script.

    Thanks Dan!

    That coming from you pretty much assures me there is not a way to do that 😀

  • The “randomly sometimes work” could be caused by using the sourceRectAtTime() on a layer on which you modify the leading, fontsize, fonWeight(basically anything that changes the sourceRectAtTime).

    I tried decreasing/increasing a font size until it filled the boxText and had the same behaviour.

  • Thanks for the kind words.

    If there’s anything I can do for you, please let me know

    Well, if you need a job in AE automation or know anyone else who needs, you can always reach me at andrei@audaciousleap.com

  • The path remains the same. Then add these to the start/end of the trim paths

    START:

    function arrIncludes(arr, element) {

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

    if (element == arr[i]) return true;

    }

    return false;

    }

    L = thisComp.width;

    l = thisComp.height;

    percentL = (50 * L) / (L + l);

    percentl = (50 * l) / (L + l);

    beginPoint = thisComp.layer("Null 1").effect("Start_Point")("Slider").value % 4;

    stopPoint = thisComp.layer("Null 1").effect("End_Point")("Slider") % 4;

    shortPoints = thisComp.layer("Null 1").effect("Reverse_Direction")("Checkbox") == 1 ? [1, 3] : [0, 2];

    firstLInstances = Math.ceil(stopPoint / 2);

    if (arrIncludes(shortPoints, beginPoint)) {

    theEnd = percentl * firstLInstances + percentL * (stopPoint - firstLInstances);

    } else {

    theEnd = percentL * firstLInstances + percentl * (stopPoint - firstLInstances);

    }

    theEnd = theEnd == 0 ? 100 : theEnd;

    if (thisComp.layer("Null 1").effect("Enable/Disable Loading")("Checkbox") == 0) {

    val = linear(time, 0, thisComp.duration - thisComp.frameDuration, 0, theEnd);

    } else {

    val = 0;

    }

    val;

    END:

    function arrIncludes(arr, element) {

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

    if (element == arr[i]) return true;

    }

    return false;

    }

    L = thisComp.width;

    l = thisComp.height;

    percentL = (50 * L) / (L + l);

    percentl = (50 * l) / (L + l);

    beginPoint = thisComp.layer("Null 1").effect("Start_Point")("Slider").value % 4;

    stopPoint = thisComp.layer("Null 1").effect("End_Point")("Slider") % 4;

    shortPoints = thisComp.layer("Null 1").effect("Reverse_Direction")("Checkbox") == 1 ? [1, 3] : [0, 2];

    firstLInstances = Math.ceil(stopPoint / 2);

    if (arrIncludes(shortPoints, beginPoint)) {

    theEnd = percentl * firstLInstances + percentL * (stopPoint - firstLInstances);

    } else {

    theEnd = percentL * firstLInstances + percentl * (stopPoint - firstLInstances);

    }

    theEnd = theEnd == 0 ? 100 : theEnd;

    if (thisComp.layer("Null 1").effect("Enable/Disable Loading")("Checkbox") == 1){

    val = linear(time, 0, thisComp.duration - thisComp.frameDuration, 0, theEnd);

    }else{

    val = theEnd

    }

    val

  • It’s certainly doable but now I am really busy with another project and this setup wil take a bit of time to finish.

    I am sorry but bills come first ?

  • It’s not clear to me. How exactly do you want the behavior to be?

    Say the checkbox is checked, so the loading is enabled. How exactly should this template behave. The line starts appearing? How much time does the animation of the appearing last? When does the unloading start? From what end does the unloading start?

    The way you explain it, if the checkbox is selected, the line is there at second 0 and it starts to unbuild until the end of the composition.

    If the checkbox is not checked, the line just starts building itself from start to end.

    Is this the behavior you want?

  • The unbuilding starts after the whole path is loaded? Or does it break it? If you have 3 lines complete and start to “undo” the line from other point than the first, then you would have 2 lines.

    So does this unbuild start after the entire lane has appeared?

  • Well, if you try to prevent someone from moving the layer, you should add an expression to position, not to anchor point. Try this on position:

    [thisComp.width/2, thisComp.height/2]
  • Actually, use this for the path expression

    cW = thisComp.width;
    cH = thisComp.height;
    corners = [[-cW/2,-cH/2], [-cW/2,cH/2],[cW/2,cH/2],[cW/2,-cH/2]];
    startCorner = thisComp.layer("Null 1").effect("Start_Point")("Slider").value%4;
    p1 = (startCorner == 0) ? [] : corners.splice(0,startCorner);
    corners = corners.concat(p1);
    if (thisComp.layer("Null 1").effect("Clockwize")("Checkbox") == 1) {
    b = corners[1];
    corners[1] = corners[3];
    corners[3]= b;
    };
    createPath(corners)
Page 21 of 65

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