Forum Replies Created

  • Nick Graves

    May 11, 2022 at 4:49 pm in reply to: “Calculate Expression just once”-hack. Legit?

    I’ve never heard of this so I have no idea how it works, but it does seem to work which is amazing. I used the new Render Time benchmark feature to compare what happens if you run your expression but remove the error code from the “else” section.

    It seems to drastically increase the render time than if you were to enable posterizeTime(0)

  • Nick Graves

    April 28, 2022 at 4:34 pm in reply to: Set 2 different fonts via expressions

    I’m not sure if there is a way to do it on one layer/expression, I tried with a similar project (blinking cursor and everything, actually!) and I just ended up creating a second text layer with the source text sampling the original text. I’m not sure how you decided to create your blinking cursor and how the expressions are set up for you, but for me it looks something like this:

    1. I grab the original text’s sourceText that I’ve animated with a range selector to have it reveal as it’s “typed.”

    originalText = thisComp.layer("original text").text.sourceText;


    2. Then I create a variable for the font style. (It’s been a bit since I learned how to do this, so I don’t remember the technical reason for why you need to write this.)

    newText = originalText.style;


    3. after that, I set an expression for the blinking cursor itself.

    I replace all the text with every character I would have used in the original text, using the javascript “replace” method and Regular Expressions to include all the characters I wanted. I didn’t have a procedural method for generating these characters, so instead I just ran my finger across my qwerty keyboard in order. Then I replaced all the characters with the character I chose to use for the blinking cursor, which is “W”.

    (For context on why this looks weird, I’m using a pixel style font where each character is inside an 8×8 pixel block, and then to create a 1 pixel outline around each character I created a second pixel font that is the Bold version. It just so happens that the “W” character is a solid 8×8 block, so I used that character for my blinking cursor icon.)

    newText = originalText.replace(/[qwertyuiopasdfghjklzxcvbnm,.?!' ]/gi,"w");

    then I updated this layer with a new Range Selector animation that trimmed down the text to show a single character, and then animated the “Offset” value with an expression tied to the original layers “Start” value so they would line up. Hopefully that is helpful, I’m unsure if our approaches are similar enough to solve anything on your end.

  • Nick Graves

    March 16, 2022 at 10:10 pm in reply to: Style a single word in a text layer?

    yeah that’s sometimes the only way to get stuff out the door, especially if it’s new territory. I found when I was messing with setStyle expressions (which was actually very recent which is why this thread peaked my interest) that there are some “unspoken rules”. For example I’m not sure how to stitch multiple strings together with different font style settings on them in a single text layer, you may have to create multiple string variables, set the font styles, and then stitch them back together at the end, like “textA + textB + textC;”

    Interesting problem and also pretty cool tutorial!

  • Nick Graves

    March 16, 2022 at 9:57 pm in reply to: Style a single word in a text layer?

    Not totally sure of how you’ve laid out your file in comparison to the tutorial, but if you are looking to get the indices of particular characters you could try the javascript search() method: https://www.w3schools.com/jsref/jsref_search.asp

    then use that to setStyle on those particular characters that match.

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