Forum Replies Created

Page 1 of 6
  • Julian Chojnacki

    July 16, 2024 at 5:52 pm in reply to: Highlight Text by ** Symbols

    Easy! Np 👊

  • Julian Chojnacki

    July 16, 2024 at 5:33 pm in reply to: Highlight Text by ** Symbols

    Would the Minimax effect work for your setup instead of using the space-replacement char?

  • Julian Chojnacki

    July 16, 2024 at 4:41 pm in reply to: Highlight Text by ** Symbols

    No probs – happy it works 🙂

    Sure, what’s next?

  • Julian Chojnacki

    July 16, 2024 at 12:19 pm in reply to: Highlight Text by ** Symbols

    Sorry Ben! Looking back at your screenshot I realized that I misunderstood your initial request. My code would only work for single words wrapped in asterisks, not multiple words in a row.

    Try this (based on characters):

    const L = thisComp.layer("Master_Text");

    const txt = L.text.sourceText.value.replace(/\n|\r|\u0003/g, "");

    const wrapChars = "**"; // Insert your desired wrap character(s)

    const wrapLength = wrapChars.length;

    let isWrapped = false, i = adj = 0;

    while (i <= textIndex - 1 + adj) {

    if (txt.substr(i, wrapLength) == wrapChars) {

    isWrapped = !isWrapped;

    adj += wrapLength;

    i += wrapLength;

    } else {

    i++;

    }

    }

    isWrapped ? 0 : 100;

  • Julian Chojnacki

    July 16, 2024 at 10:21 am in reply to: Highlight Text by ** Symbols

    Ahh, I see you got some spaces in between the parentheses of the regex. Getting rid of them should fix it!

  • Julian Chojnacki

    July 16, 2024 at 9:31 am in reply to: Highlight Text by ** Symbols

    Shouldn’t be – can you send over a screenshot of your setup/project file?

  • Julian Chojnacki

    July 15, 2024 at 9:34 pm in reply to: Highlight Text by ** Symbols

    Just noticed that the formatting messed up the regex. You’ll need to add a backtick ` after the opening parenthesis and before the ending parenthesis (marked by X):

    const regex = new RegExp(X^${escapedWrapChars}([^${escapedWrapChars}]*)${escapedWrapChars}$X);
  • Julian Chojnacki

    July 15, 2024 at 9:16 pm in reply to: Highlight Text by ** Symbols

    Hi Ben,

    try the following on your expression selector, but based on words (which is more efficient than looping over each char):

    const wrapChars = "**"; // Insert your desired wrap character(s)

    const L = thisComp.layer("Master_Text");

    const controlText = L.text.sourceText.value;

    const currentWord = controlText.split(/\s+/)[textIndex - 1];

    const escapedWrapChars = wrapChars.replace(/./g, "\\$&");

    const regex = new RegExp(^${escapedWrapChars}([^${escapedWrapChars}]*)${escapedWrapChars}$);

    regex.test(currentWord) ? 0 : 100;

    You can change the wrapChars to any character(s) if you want to reuse the expression for other setups.

    Make sure to remove all instances of your wrapChars on your display layer’s source text using something like this:

    thisComp.layer("Master_Text").text.sourceText.value.replaceAll("**", "");

    But I assume you already have something like that in place 🙂

  • Julian Chojnacki

    July 10, 2024 at 2:43 pm in reply to: Detect Shape Layer Path

    Hi Michael,

    you can check if a layer is a shape layer like this:

    isShapeLayer = thisLayer.content instanceof Group;

    isShapeLayer; // Returns 1/true or 0/false

    Regarding the path detection: do you explicitly need to check for Bezier Paths, or would it be enough to check for any existing content (groups, primitives, paths)?

    The latter could look like this:

    hasContent = thisLayer.content.numProperties > 0;

    hasContent; // Returns 1/true or 0/false

    Both combined:

    L = thisLayer;

    isShapeLayer = L.content instanceof Group;

    hasContent = L.content.numProperties > 0;

    isShapeLayer && hasContent; // Returns 1/true or 0/false

  • Hi Filip, any updates on the final v2 of subSourceRect? 🙂 I’ve noticed that fractions don’t work reliably for all framerates depending on the granularity of the setup (your single-layer textboxes for example seem to only work for framerates < 40), and all my efforts to find a robust solution weren’t successful. If you found a way to make the technique production-ready that’d be a true blessing!

Page 1 of 6

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