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

Slider countdown expression but add "%"?

Community Beginner ,
Jan 18, 2019 Jan 18, 2019

Copy link to clipboard

Copied

Hello AE Community!

Is there a way to add a character - specifically "%" - to the text in a countdown expression?

Right now I have the expression:

Math.round(thisComp.layer("Values").effect("Value_1")("Slider"))

and it is working just fine for displaying the number related to the slider.  I would like to add a "%" on the end, so that when it changes from 100 to 99, and then from 10 to 9, the tracking stays consistent between the numbers, so I don't end up with "9  %"

I have thought of some work-arounds, but I was hoping there was some simple language to put into the expression to add the "%" mark.

Thanks!

TOPICS
Expressions

Views

2.8K

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 ,
Jan 18, 2019 Jan 18, 2019

Copy link to clipboard

Copied

Let's start simple. Does this not work for you?

Math.round(thisComp.layer("Values").effect("Value_1")("Slider"))+"%"

Dan

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 ,
Jan 18, 2019 Jan 18, 2019

Copy link to clipboard

Copied

Thanks for replying, Dan.

I tried that, and a few variations, but it kept turning my number into “NaN” whenever “%” was in my expression.

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 Expert ,
Jan 18, 2019 Jan 18, 2019

Copy link to clipboard

Copied

Did you apply the expression to a numeric property (like a slider control)? You would need to apply it to a text layer.

Dan

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 ,
Jan 20, 2019 Jan 20, 2019

Copy link to clipboard

Copied

Yes, it is on a text layer.

if ‘+ “%”’ should work, then perhaps something else in my composition is causing the problem.

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 Expert ,
Jan 20, 2019 Jan 20, 2019

Copy link to clipboard

Copied

LATEST

make sure the +"%" operation is applied after all mathematical operations (like rounding) you do with the number. Does the NaN only occur with the "+"%" or also if you remove this part from the expression?

Maybe you best post the entire expression you use.

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