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

Uppercase to Lowercase text animation using expressions

Community Beginner ,
Feb 20, 2024 Feb 20, 2024

I have some text in a comp that I would like to morph from uppercase to lowercase per character/word over time using a slider control. I have managed to achieve the result in part, however all of the words are changing together rather than per character/word and I was wondering if there's a way to do this. Attached is a screen recording of the project

 

I have added the following expressions to the layer Source Text:
txtCase = effect("FontCase")("Slider").value;

txtColour = effect("Colour")("Color").value;

text.sourceText.style .setAllCaps(txtCase)

.setFillColor(txtColour)

 

Thanks very much for any tips

 

Harvey

TOPICS
Expressions , Scripting
1.2K
Translate
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

correct answers 1 Correct answer

Advocate , Feb 20, 2024 Feb 20, 2024

 HarveyB_Yardi.gif

 

You can use source text expression and fill color text animator and 1 slider control to control the speed

Source text expression:

 

 

u = value.toUpperCase();
l = value.toLowerCase();
speed = effect("speed")(1);
l.substr(0, time * speed) + u.substr(time * speed, u.length)

 

 

 

Fill color text animator -> End:

 

 

speed = effect("speed")(1);
time * speed
//try one of these:
time * speed
Math.floor(time * speed)

 

 

Advanced -> Units -> set to Index

 

screenshot.png

 

 

Translate
LEGEND ,
Feb 20, 2024 Feb 20, 2024

Use two layers and text animators. You are making this way too complicated and it won't work, anyway. Text style expressions always affect the whole text. It's a limitation of the process.

 

Mylenium

Translate
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 ,
Feb 20, 2024 Feb 20, 2024

Hi Mylenium,

 

Thanks for your reply. I'm new to working with expressions so not familiar with their capabalities or limitations.

I did wonder if I was overcomplicating the solution, however I know there are no animation properties for in the text character panel and thought it would save time if there was one expression rather than adding lots of extra text layers to my comp.

 

Thanks again,

 

Harvey

Translate
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
Advocate ,
Feb 20, 2024 Feb 20, 2024

 HarveyB_Yardi.gif

 

You can use source text expression and fill color text animator and 1 slider control to control the speed

Source text expression:

 

 

u = value.toUpperCase();
l = value.toLowerCase();
speed = effect("speed")(1);
l.substr(0, time * speed) + u.substr(time * speed, u.length)

 

 

 

Fill color text animator -> End:

 

 

speed = effect("speed")(1);
time * speed
//try one of these:
time * speed
Math.floor(time * speed)

 

 

Advanced -> Units -> set to Index

 

screenshot.png

 

 

Translate
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 ,
Feb 20, 2024 Feb 20, 2024

Hi Airweb_AE,

 

Awesome thank you for the tip. That looks exactly like what I am trying to achieve. I will give this a try.

 

Harvey

Translate
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 ,
Feb 20, 2024 Feb 20, 2024

That's a nice solution. I would advise, in general, though, against using a local variable named "speed" because most properties (including End) already have a speed attribute. This conflict can lead to hard-to-debug, unexpected results.

Translate
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 ,
Feb 21, 2024 Feb 21, 2024

Hi Dan,

 

Thanks very much for your advice. That's good to know. I will try naming the variable something else.

 

Harvey

Translate
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 ,
Feb 21, 2024 Feb 21, 2024

Hi Airweb_AE,

 

Just added the expressions to my project and it works great. Thank you very much for the help. Alongside changing the  I wanted to keep the first letter of each sentence as Uppercase so altered the expression slightly. Here's what it looks like in case anyone else is trying to do the same.

 

Source text expression:

 

u = value.toUpperCase();
l = text.sourceText.split(" ")[0].charAt().toUpperCase() + substring(1, text.sourceText.split()[0].length).toLowerCase();

spd = effect("Velocity")(1);
l.substr(0, time * spd) + u.substr(time * spd, u.length)

 

Fill color text animator -> End:

 

spd = effect("Velocity")(1);
time * velocity
//try one of these:
time * spd
Math.floor(time * spd)

 

Advanced -> Units -> set to Index

 

Screen-Recording-2024-02-21-at-11-50-49.gif

Translate
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
Advocate ,
Feb 21, 2024 Feb 21, 2024

Each sentence:

 

l = value.toLowerCase().charAt(0).toUpperCase() + value.toLowerCase().slice(1);

 

Each line:

 

l = value.split('\r').map(str => str.toLowerCase().charAt(0).toUpperCase() + str.toLowerCase().slice(1)).join('\r');

 

Translate
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 ,
Mar 06, 2024 Mar 06, 2024
LATEST

Hi Airweb_AE,

 

Really sorry I missed this part of the conversation. Thank you very much for the additional advice. I will be sure to come back to this method in future.

Translate
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