• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Changing text colour midway through a sentence with expressions

Community Beginner ,
Jul 11, 2022 Jul 11, 2022

Copy link to clipboard

Copied

I am trying to create a MoGrt for a client, and at one stage the client needs to input 2 values in the same text sentence, the issue I'm having is I need the second input to be a different colour.

My source text field will look something like this:

 

"input 1" + (different colour)"input 2"

 

I cannot seem to find the right way to word this in expressions, to change colour at the marked point. I know how to link the text input using other text layers but can anyone help me with the expression to change the text fill colour before the second input.

 

Thanks!

TOPICS
Expressions , Scripting

Views

147

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 11, 2022 Jul 11, 2022

Copy link to clipboard

Copied

As far as I know, you cannot control the color of individual letters with an expression on the source text. But you can do things like that with a range selector expression: https://www.youtube.com/watch?v=wgiaNEQit3g

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 11, 2022 Jul 11, 2022

Copy link to clipboard

Copied

Thanks for the reply, I'll give it a shot and see how I go!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 11, 2022 Jul 11, 2022

Copy link to clipboard

Copied

LATEST

Thanks, you really set me on the right path, here's my solution:

 

- I applied a fill effect using text animators to the final text layer

- Applied this expression to the final text layer referencing the two input text layers:

      thisComp.layer("Input 1").text.sourceText + " " + thisComp.layer("Input 2").text.sourceText

- I applied this expression to the range selector 'start' which is set to 'index' instead of 'percentage':

      thisComp.layer("Input 1").text.sourceText.length

- Set the end range to a very high number

 

Now the colour change is applied after the first text input.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines