Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions space symbol ” ” in Ae expressions

  • space symbol ” ” in Ae expressions

  • Alex Andry

    January 20, 2021 at 8:26 am

    Hi guys, I’m trying to repeat the text along path, but the end of the text and the beginning are connected without a space ” “. If I put “. “, then the break (space) after dot works. Is there a way to make a break without a dot, just a space.

    txt = thisComp.layer(“source”).text.sourceText+” “;

    num= 10 ;

    xRepeater = num;

    horzRepeat = ” “+txt.repeat(xRepeater); // does not work

    horzRepeat = “. “+txt.repeat(xRepeater); // space works after dot

    Thanks in advance!

  • Filip Vandueren

    January 20, 2021 at 9:34 am

    You could add 1 character that has the same width as the space (could be “-“ or “_” or “m”, whatever; it depends on the font and you can experiment to find the best one.).

    And then use a text animator to select just that 1 character and set its opacity to 0

  • Alex Andry

    January 20, 2021 at 10:12 am

    Hi Filip,

    Of course, I did this, added a “symbol” and made it transparent in the animator. But in any case, these are crutches for expression. Distance between words will constantly change due to repeaters, and the width of the “symbol” will not. During the cyclic animation along path (I have previously indicated to calculate the length of the path), this discrepancy is visible.I was hoping that in newer versions of Ae it is possible to put a space.

    thanks for your reply

  • Filip Vandueren

    January 20, 2021 at 11:02 am

    Right, I understand better now.

    Is it always 1 word that is repeated or a sentence of different words ?

  • Alex Andry

    January 20, 2021 at 11:26 am

    The number of repeats will change depending on the length of the text with the slider. The shorter the text, the more repeats. But with these changes, the gap between repetitions changes. The space is always different in this case, since Force Alignment is enabled.

  • Filip Vandueren

    January 20, 2021 at 1:06 pm

    OK, this works:

    txt = text.sourceText+" \u200B";
    txt.repeat(10);

    Unicode character 200B is a zero-width space, after the regular space, it doesn’t interfere with anything in the middle repeats, and it fixes the final margin.

  • Alex Andry

    January 20, 2021 at 1:32 pm

    Thank you Filip! It even works without a dot “. ” !

  • Filip Vandueren

    January 20, 2021 at 1:48 pm

    Bonus:

    If you have your original Text in another Layer, you can automatically calculate the optimal number of repeats by dividing the approximate length of the Path by the width of the original Text.

    Like this:

    originalTxt = thisComp.layer("Original Text").text.sourceText;
    txt = originalTxt.value+" \u200B";
    w = thisComp.layer("Original Text").sourceRectAtTime().width;
    // get approximate length of path
    l = 0;
    precision = 10;
    txtPath = mask(text.pathOption.path.toString()).maskPath;
    p0=txtPath.pointOnPath(0, t = time);
    for (i=1; i<=precision; i++) {
    p1 = txtPath.pointOnPath(i/precision, t = time)
    l+=length(p0, p1);
    p0=p1;
    }
    repeats = Math.max(1,Math.floor(l/w));
    style = originalTxt.style; // make sure we also get formatting of original text
    style.setText(txt.repeat(repeats));

    See an example here:

    https://imgur.com/GMKnST8

    View post on imgur.com

    View post on imgur.com

  • Alex Andry

    January 20, 2021 at 2:15 pm

    Bonus??? It is fantastic!!! Part of this expression also calculated the path length in my expression for animation, but I used this parameter for animation only. You have made a very elegant expression without extra controllers. I am grateful to you Filip!

Viewing 1 - 9 of 9 posts

Log in to reply.

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