Skip to main content
Inspiring
January 24, 2023
Answered

Can I animate / keyframe the text that becomes before and/or after a counting number expression?

  • January 24, 2023
  • 1 reply
  • 282 views

I'm following this tutorial video to animate a counting number with a slider effect and some preceding and following text. 

The expression I have currently:

 

"~"+effect("Slider Control")("Slider").value.toFixed(0)+" million"

 

The "~" before and the " million" I also need to be able to keyframe and change the text, how can I do this?

I've tried using dummy text layers and tried to pickwhip their source text but that didn't work. 

This topic has been closed for replies.
Correct answer production152024797

Thank you very much Mylenium!

For my purposes I actually ended up using the source text of dummy layers, maybe it's a little clunky but it works for what I need - i just needed to remove the quote marks and the following expression worked with my dummy layers:

 

thisComp.layer("~").text.sourceText+effect("Slider Control")("Slider").value.toFixed(0)+thisComp.layer(" million").text.sourceText

 

If i have a more complex need in the future though i will try your seemingly more elegant solution. 🙂

1 reply

Mylenium
Legend
January 24, 2023

You could put them in an array and then address that either automatically based on the value or via sliders. Your code would look something like that:

 

 

 

mNum=effect("Animated Value")("Slider");
mEnd=effect("End Value")("Slider");
mUni=["thousand","million","billion"];
mPre=["~","="];

if (mNum.length <= 4)
{mUni=mUni[0]}
else if (mNum.length <= 7)
{mUni=mUni[1]}
else
{muni=mUni[2]};

if(mNum < mEnd)
{mPre=mPre[0]}
else
{mPre=mPre[1]};

mPre+mNum.toFixed(0)+" "+mUni

 

 

 

Mylenium

production152024797AuthorCorrect answer
Inspiring
January 24, 2023

Thank you very much Mylenium!

For my purposes I actually ended up using the source text of dummy layers, maybe it's a little clunky but it works for what I need - i just needed to remove the quote marks and the following expression worked with my dummy layers:

 

thisComp.layer("~").text.sourceText+effect("Slider Control")("Slider").value.toFixed(0)+thisComp.layer(" million").text.sourceText

 

If i have a more complex need in the future though i will try your seemingly more elegant solution. 🙂