Forum Replies Created

Page 24 of 65
  • Andrei Popa

    August 19, 2020 at 3:25 pm in reply to: Dynamic Type Maintaining Distances

    sourceRectAtTime calculates the rectangle as if the scale was 100. It does not take into account the scale.
    You need to multiply the values that are not working good with one value from scale.
    Ex:


    BODY POSITION:

    headlineLayer = thisComp.layer("HEADLINE_01")
    box = headlineLayer .sourceRectAtTime(time);
    offset = box.height/2;
    y = position[1] + offset*headlineLayer.scale[1] ;
    x = value[0];
    [x, y];

    You may need to modify some of the other expressions too.

    Andrei
    My Envato portfolio.

  • Andrei Popa

    August 19, 2020 at 8:53 am in reply to: Saving CSV or TXT File In AE

    You can do that via scripts. Save this in a file with the .jsx extension


    var myComp = app.project.activeItem;
    var filePath = app.project.file.path + "/" + myComp.name + ".txt";
    var layerList = createTextFromComp(myComp);
    createFile(filePath, layerList);

    function createFile(filePath, content) {
    var myFile = new File(filePath);
    if (myFile.open("w")) {
    myFile.encoding = "BINARY";
    myFile.write(content);
    myFile.close();
    } else {
    alert("Error opening file " + myFile.displayName + ": " + myFile.error, "Function createFile");
    }
    }

    function createTextFromComp(myComp) {
    layerNames = [];
    numberOfLayers = myComp.numLayers;
    for (var i = 1; i <= numberOfLayers; i++) {
    layerNames.push(myComp.layer(i).name);
    }
    return layerNames.join("\n");
    }

    Then, before running this, make sure that your project is saved.
    Run the script by File>Scripts>Run Script File… and choose the file you saved.
    It will create a txt file in the same destination as your project with the comp name and inside the list of all the layers.

    Andrei
    My Envato portfolio.

  • Andrei Popa

    August 19, 2020 at 7:14 am in reply to: String template literal not working

    Again, try the settings I recommended in the other post. Both your expressions work in my project.

    Andrei
    My Envato portfolio.

  • Andrei Popa

    August 19, 2020 at 7:13 am in reply to: arrow function not working

    Check if File>Project Settings> Expressions is set to “JavaScript” and not “Legacy ExtendScript”

    Andrei
    My Envato portfolio.

  • Andrei Popa

    August 18, 2020 at 2:55 pm in reply to: Text Contained Within String

    About searching things better. Here is what I suggest:

    You need to learn few keywords like string, number, array.
    Then search what you want to find out with javascript.
    For example, searching “find a word in string javascript” returns 2 results from w3schools which both could of helped you ;D

    Andrei
    My Envato portfolio.

  • Andrei Popa

    August 18, 2020 at 8:16 am in reply to: Text Contained Within String

    Here to correct and annoy people ?

    In case indexOf() does not find a value, it returns -1. -1 is truthy, so this always returns Yes.
    In case he intends to use this in the new expression engine, else does not work on the same line with if.


    MyString = "This is my text"
    if (MyString.indexOf("my")!=-1) "Yes"
    else "Nope"

    Andrei
    My Envato portfolio.

  • Andrei Popa

    August 15, 2020 at 6:25 am in reply to: style.setFont not working with toString

    Try this


    var array = [
    "Metropolis-Regular",
    "Didot-Bold",
    "Roboto-BoldCondensed"
    ];

    r = Math.round(text.animator("Animator 1").property.fillColor[0]*255).toString(16);
    if (r.length < 2) r = "0" + r;
    g = Math.round(text.animator("Animator 1").property.fillColor[1]*255).toString(16);
    if (g.length < 2) g = "0" + g;
    b = Math.round(text.animator("Animator 1").property.fillColor[2]*255).toString(16);
    if (b.length < 2) b = "0" + b;

    text.sourceText.style.setFont(array[1]).setText('#' + r + g + b);

    Andrei
    My Envato portfolio.

  • Andrei Popa

    August 14, 2020 at 6:59 am in reply to: Checking text field for line breaks?

    That is exactly how it works! Congrats!

    Andrei
    My Envato portfolio.

  • Andrei Popa

    August 13, 2020 at 6:25 am in reply to: Checking text field for line breaks?

    Let’s say you assign your text to variable “txt”. This should return the number of line feeds that your text has

    var newLines = txt.split("\r").length-1;

    If you only want to check if there is a line break, and not the number of them, you can use this

    hasNewLines = txt.indexOf("\r") == -1 ? false : true;

    Andrei
    My Envato portfolio.

  • It’s my mistake. I am sorry, the autocorrect on my text editor added parenthesis on the last lane for no reason. Here is the actual expression.


    var CamSpeed = thisComp.layer("Adjustment Layer 1").effect("Cam_Speed")("Slider");

    var PULL = time < marker.key(1).time ? value[2] - time * CamSpeed : value[2] - marker.key(1).time * CamSpeed;
    [value[0], value[1], PULL];

    Andrei
    My Envato portfolio.

Page 24 of 65

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