Highlighted

Using new text expression in AE2020 to apply multiple styles to a single text layer

New Here ,
Nov 05, 2019

Copy link to clipboard

Copied

Hi.

I'm playing around with After Effects 2020's new text expression tools
and I roughly understand about the newly added functions.

However I couldn't find the way to set multiple styles in a single layer.
What I wanted to do is : Only the first letter is set to bold and the rest will be left as it is.

 

SnapCrab_No-0506.png
(I know it's possible by setting manually without expressions)

Is there any way to do this?
What do you think?

TOPICS
Expressions, How to

Views

812

Likes

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

Using new text expression in AE2020 to apply multiple styles to a single text layer

New Here ,
Nov 05, 2019

Copy link to clipboard

Copied

Hi.

I'm playing around with After Effects 2020's new text expression tools
and I roughly understand about the newly added functions.

However I couldn't find the way to set multiple styles in a single layer.
What I wanted to do is : Only the first letter is set to bold and the rest will be left as it is.

 

SnapCrab_No-0506.png
(I know it's possible by setting manually without expressions)

Is there any way to do this?
What do you think?

TOPICS
Expressions, How to

Views

813

Likes

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
Nov 05, 2019 2
Explorer ,
Nov 05, 2019

Copy link to clipboard

Copied

I have the same issue. I tried making 2 layers. The first had this expression to the text source :

 

value + thisComp.layer("layer2").text.sourceText.style.setFont("TimesNewRomanPS-BoldMT")

 

I expected to get the value plus the second layer content in bold TNR. Instead, i got the value plus "[object Object]" and no change to the style whatsoever.

 

 

Likes

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
Reply
Loading...
Nov 05, 2019 1
Adobe Community Professional ,
Nov 05, 2019

Copy link to clipboard

Copied

The expression needs to start with style. They look like this:

 

var fs=effect("Slider Control")("Slider");
style.setBaselineShift(100);
style.setFont("TimesNewRomanPS-BoldMT");
style.setFontSize(fs)

 

I added an expression control slider and called it fs, then I set the baseline shift to 100, the font to Times New RomanPS-BoldMT, and set the font size to the value of the slider.

Screenshot_2019-11-05 23.16.55_33sHjE.png

 

The language is covered a bit in the new features page for AE. The expression language menu will also give you a clue to the right syntax. Anytime there is another panel that pops up with properties, one of the methods listed in the previous panels must precede it. 

Screenshot_2019-11-05 23.26.14_Pa0uls.png

Everything listed in the far left column must be preceded by either style. or getStyleAt(charindex, t=time). or createStyle(). I am sure that there will be more information coming soon.

Likes

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
Reply
Loading...
Nov 05, 2019 1
New Here ,
Nov 06, 2019

Copy link to clipboard

Copied

Thank you for your reply.

I've just added a picture to my original post which describes what I want to do.

Likes

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
Reply
Loading...
Nov 06, 2019 0
Guide ,
Nov 06, 2019

Copy link to clipboard

Copied

Not tested, but try simple string methods:

 

a = "T";

a.styleOfFirstLetter;

b = "e";

b.styleOfSecondLetter;

 

a+b;

 

*Martin

Likes

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
Reply
Loading...
Nov 06, 2019 0
Enthusiast ,
Nov 06, 2019

Copy link to clipboard

Copied

That doesn't work. It looks like the + operator isn't defined for these objects (TextDocument I think it's called?), so the engine just casts the objects to strings resulting in  "[object Object][object Object]" being applied to the sourceText value.

 

Looking at the sparse documentation, I'm coming to the conclusion that you can only define a style for the entire text layer, which is pretty disappointing if true. I had really hoped this would finally give us the tools we need to automate type with mixed styles. This functionality will be useful, don't get me wrong, but if I'm right about this it's not the game changer I was hoping for.

 

I'd be really happy if someone can prove me wrong, though.

 

What's really peculiar is there is a function to *get* the style of an individual character, just not one to *set* it. I guess I can think of some marginal cases where the getter would be useful without the setter, but if for some reason I could only have one, I would definitely find the setter more useful.

Likes

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
Reply
Loading...
Nov 06, 2019 3
Guide ,
Nov 06, 2019

Copy link to clipboard

Copied

Word.

Likes

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
Reply
Loading...
Nov 06, 2019 0
New Here ,
Nov 07, 2019

Copy link to clipboard

Copied

Totally agree, we need *set* style !

Likes

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
Reply
Loading...
Nov 07, 2019 1
Adobe Community Professional ,
Nov 06, 2019

Copy link to clipboard

Copied

Currently, you can "getStyleAt()" but "setStyleAt()" is not a function. If you reference another layer and you have manually set the first character to Faux Bold or even a different font you should be able to have that show up in a new text layer, but I don't see any method defined that would set a style at a specific character index. It would be a great feature request.

Likes

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
Reply
Loading...
Nov 06, 2019 0
Enthusiast ,
Nov 06, 2019

Copy link to clipboard

Copied

If you reference the style of another text layer (without using getStyleAt()) all you get is the style of the first character, and it is applied to every character of the referencing layer. So your whole text layer will be faux bold, not just the first character.

Likes

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
Reply
Loading...
Nov 06, 2019 0
Adobe Community Professional ,
Nov 06, 2019

Copy link to clipboard

Copied

You can use getStyleAt(3) to get the style of the fourth letter in a text layer. What is needed is setStyleAt(0) to set the style of the first letter in a new text layer. That option does not exist in the current release. I've already filed a feature request.

Likes

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
Reply
Loading...
Nov 06, 2019 0
Enthusiast ,
Nov 07, 2019

Copy link to clipboard

Copied

If you'll link to the feature request I'll gladly vote for it.

Likes

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
Reply
Loading...
Nov 07, 2019 0
Community Beginner ,
Dec 24, 2019

Copy link to clipboard

Copied

I too assumed this would be possible with the new text expressions and am sad to see it isn't. But a good start! Someday we'll be able to setStyleAt(). Hopefully.

Likes

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
Reply
Loading...
Dec 24, 2019 2