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

Split text with slider?

Explorer ,
Nov 29, 2023 Nov 29, 2023

Copy link to clipboard

Copied

I'm continuing on a problem that the community helped me solve a couple of weeks ago.

 

Align two text layers 

 

Skarmavbild-2023-11-16-kl.-10.51.53.jpg

 

I have a main text layer that is centred ("CENTER.HEADLINE") and a left justified text layer ("Left justified text") that is left justified to the left side of CENTER.HEADLINE and moves dynamically when I change the headline text.
All text is animated.
First the "Left justified text" drops down, then CENTER. drops down and the HEADLINE animates - left to right.

CENTER. is in the clients brand typeface and HEADLINE is the same typeface but in an outlined version.

I've marked it in red to make it more clear.

What i've done is I have a hidden Main text layer that is controlled in the Essential graphics panel and have two text layers - one for CENTER and one for HEADLINE wit the two different typefaces and the I used "split" expression and set it to split at "HEA" since the word that is used instead of HEADLINE in the films are constant and the words that is instead of CENTER always changes.

That worked out fine since we where told the translation was only going to be in subtitles.

But now the client changed their mind and I need to make the MOGRT work in 38 languages.

 

In a perfect world they separate the two chunks of text with the dot.

But I want to keep as many options open since I'm not certain all languages translates the same way.

 

Is it possible to link the split expression to a slider? Split at a certain number of characters?

Like in this example: split after character 7 - the dot

 

The expression I've used is this:

 

 

txt = thisComp.layer("Main_text").text.sourceText.split("HEA");
n = 1;
if (txt.length >= n)
txt[n-1]
else
""

 

 

 

TOPICS
Expressions

Views

193

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

correct answers 2 Correct answers

Community Expert , Nov 29, 2023 Nov 29, 2023

Something like this maybe:

txt = thisComp.layer("Main_text").text.sourceText;
s = effect("Slider Control")("Slider");
txt.substr(0,s)

Votes

Translate

Translate
Community Expert , Nov 29, 2023 Nov 29, 2023

Change the last line to this:

txt.substr(s)

Votes

Translate

Translate
Community Expert ,
Nov 29, 2023 Nov 29, 2023

Copy link to clipboard

Copied

Something like this maybe:

txt = thisComp.layer("Main_text").text.sourceText;
s = effect("Slider Control")("Slider");
txt.substr(0,s)

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
Explorer ,
Nov 29, 2023 Nov 29, 2023

Copy link to clipboard

Copied

Awsome!

Thanks Dan!

Works like a charm for the first part.

Is it possible to "invert" it for the second part - The HEADLINE word

Like the example above - i drag the slider to 7 and it reveals CENTER.

What expression do i put in the source text on the HEADLINE layer to reveal character 8 and onwards?

 

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 ,
Nov 29, 2023 Nov 29, 2023

Copy link to clipboard

Copied

Change the last line to this:

txt.substr(s)

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
Explorer ,
Nov 29, 2023 Nov 29, 2023

Copy link to clipboard

Copied

LATEST

After some tweeking I got it to work with my previous setup!

Thanks a bunch Dan!

A real lifesaver!!

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