Forum Replies Created

Page 14 of 65
  • I think the anchor point in your picture is correct, and it is the left boundary of the layer, boundary given by the dot of the i.

  • I have tried your expression on a text layer and it works fine unless I use stroke. If I use any stroke, the text goes a bit off. The thicker the stroke, the bigger the difference.

  • Andrei Popa

    September 14, 2021 at 3:06 pm in reply to: Sourcetext ignore ( or create ) line breaks

    Maybe use the 1080 comp text in the 1920 but replace newlines with spaces. Something like:
    text.sourceText.replace(/\r/g,” “)

  • Andrei Popa

    September 14, 2021 at 8:30 am in reply to: Is there still a viable way to write AE scripts ?

    I use VSC for developing my stuff. Once I go on testing, I also open my scripts in ESTK (I don’t even have the debugger installed now, it messed up with ETSK). When you modify in one place, it usually also applies in the other. ETSK has the object model which is A TON of help. When I try dissecting a property, I run a line like

     var a = app.project.activeItem.layer(1).text.sourceText.value;

    Then I go to model viewer and I can see everything about my property. I found A LOT about AE structure this way. I did not see this in any other text editor.

    I also run my scripts with Adobe Script Runner by renderTom. Never failed me. Now also works with code that is not yet saved. So to just test a small snippet, I ctrl+n, paste and run.

    I can also recommend this GitHub – alexmunteanu/VS-Code-Adobe-Development-Utils: Provides several utilities for Adobe scripts development. I especially like the feature that turns code into string. I use it when I need to apply my expressions via script, and I need them in a string variable.

  • Andrei Popa

    September 13, 2021 at 5:42 pm in reply to: Text building upwards and ignoring descenders

    Is that a paragraph text or a point text? Meaning, are the rows broken with “Enter” or are they auto by the borders of the paragraph text?

    If paragraph text:

    posterizeTime(0);
    function getNumRows(myLeading, myFontSize, height) {
    H = height - myFontSize * 0.5;
    return Math.floor(H / myLeading);
    }
    H = sourceRectAtTime(time, false).height;
    var myStyle = text.sourceText.style;
    myFontSize = myStyle.fontSize;
    myLeading = myStyle.autoLeading ? myFontSize * 1.2 : myStyle.leading;
    numRows = getNumRows(myLeading, myFontSize, H);
    S = scale[1] * 0.01;
    value - [0, numRows * myLeading * S];

    If point text:

    var myStyle = text.sourceText.style;
    myFontSize = myStyle.fontSize;
    myLeading = myStyle.autoLeading ? myFontSize * 1.2 : myStyle.leading;
    S = scale[1] * 0.01;1
    numRows = text.sourceText.split("\r").length;
    value - [0, numRows * myLeading * S];
  • Andrei Popa

    September 13, 2021 at 7:53 am in reply to: Parsing JSON Files – Fastest possible way?

    Hi Tomas. I think I got confused at some point with my answers. I just checked on my code and I use $.evalFile() to read the json’s. I remember doing some tests and that I used what was fastest. This is how I use it:

    var alpha = $.evalFile(File("path/to/file/json.json"));

    However, if you ever need to take the whole content of a file again, I suggest reading it with

    var str = fileObj.read();

    It reads the whole file in one go.

    Here is a link with the description, page 53

    JavaScript Tools Guide (macromedia.com)

    I don’t think evalFile will work with the new expressions engine so maybe you will need to use the eval([string]) version if you want to use it in expressions.

  • Andrei Popa

    September 11, 2021 at 2:22 pm in reply to: Parsing JSON Files – Fastest possible way?

    If you read A from file, you should B = eval(A) to get the object. Then you should use B.toSource() only if you modified something and want that to be saved back inside the file.

  • You did not say you have a textBox. The textbox case is more complicated as you need to find the number of lines not by splitting by \r. Here, try this is you have a textbox. You can link the diff to a slider for an easier setup. Once you figure out the correct diff, it should work if you don’t change the font size or box size. I hope this helps.


    function getNumRows(myLeading, myFontSize, height) {

    H = height - myFontSize * 0.5;

    return Math.floor(H / myLeading);

    }

    const diff = 100;

    H = sourceRectAtTime(time, false).height;

    const myStyle = text.sourceText.style;

    const myFontSize = myStyle.fontSize;

    const myLeading = myStyle.autoLeading ? myFontSize * 1.2 : myStyle.leading;

    const numLines = getNumRows(myLeading, myFontSize, H);

    const myHeight = myLeading * (numLines - 1)-diff;

    [0, myHeight/2]

  • I do not fully understand what the first checkbox does.

    If the second is checked, the opacity is zero. But if the first is checked/unchecked?

  • Andrei Popa

    September 6, 2021 at 3:38 pm in reply to: Parsing JSON Files – Fastest possible way?

    I use some json structure for some of my scripts. They go to as much as 1.4 mb and the load is almost instant. As method I open the file, read the whole content inside a variable and then eval that string variable. Then I use what part of the new created object I need.

    The files were created with toSource() from a big var object.

Page 14 of 65

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