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

Changing Color of Text Added Through Expression

Engaged ,
Oct 11, 2020 Oct 11, 2020

Copy link to clipboard

Copied

I'm hoping that the masses here can help me solve a problem.

 

Here's the super-condensed version: I've got a counter on an AE layer parented to a slider effect, and I've added text to it before and after with an expression (I think it's one of Dan's expressions; TextBefore and TextAfter, and at the end it's literally just TextBefore+s+TextAfter).

So what I'm looking for is a way to set the text color for TextBefore and TextAfter, either when the variables are defined or in the equation at the end. The color for TextBefore and TextAfter that I'd like is 255x192x0/FFC000; the color for the slider value I'd like is 255x255x255/FFFFFF.

 

I've searched all over and I can't find how to do this. Help please???

TOPICS
Expressions

Views

604

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 ,
Oct 11, 2020 Oct 11, 2020

Copy link to clipboard

Copied

Try to share the full expression you're using so we can help you better, anyway, you can check this helpful link where you can see all the expression you can use to set a fill color for your text https://helpx.adobe.com/after-effects/using/expressions-text-properties.html 

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
Engaged ,
Oct 11, 2020 Oct 11, 2020

Copy link to clipboard

Copied

Here's the expression (it's on the Source Text property of the text layer if that makes a difference):

countTotal=100;
textBefore = "Total Space Used: ";
textAfter = " GB";
n="" + Math.round(effect("Slider Control")("Slider")*countTotal/100);
s="";
for(i=0, l=n.length; i<l; i++){
if(s && s!="-" && (l-i)%3 ==0)
s+=",";
s += n[i];
}
textBefore+s+textAfter;

 

I've already gotten the Slider effect set up the way I need it to display (whole numbers only, no decimal places), and I've got the expression set up to make it read like this: "Total Space Used: 55 GB" (slider changes the number, and the expression is adding the caption and the units). What I'd like is for "Total Space Used" (textbefore) and "GB" to show up as gold, and the "55" (the part parented to the slider) to show up as white.

 

What do you think--possible?

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
Engaged ,
Oct 11, 2020 Oct 11, 2020

Copy link to clipboard

Copied

LATEST

PS @OussK I glanced at the article, a lot of that is over my head (full disclosure: I'm very much a novice when it comes to expressions and I know I need to get better; the functions on the page you linked that talk about helping keep text properties synched across multiple layers is something I could get a lot of mileage out of, I just don't know enough yet to make them work).

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