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

HOW TO SET DIFFERENT STYLES FOR MULTIPLE LINES

Community Beginner ,
Dec 05, 2020 Dec 05, 2020

How can I set different styles for multiple lines. If i have two line, i need to set different styles for both the lines on the same layer

 

 

TOPICS
Expressions , How to
1.3K
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
LEGEND ,
Dec 05, 2020 Dec 05, 2020

What do you specifically mean by "style"? Expressions? Layer Styles? Basic text formattting? Something else? You need to clarify and explain better.

 

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 ,
Dec 05, 2020 Dec 05, 2020

Style in terms of color, font of the text. I have a double line in the same layer. I want to apply a different font, size and color to first line and then apply a different font, size color to the second line. I want to achieve this using expressions.

 

 

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 ,
Dec 05, 2020 Dec 05, 2020

I have tried the below, but this doesn't seem to work

 

display = splits[0] + “\r”;

b = thisComp.layer(“Test”).text.sourceText.getStyleAt(0); // getting style from another layer

style = b;

style.setText(display); // applying style to the display variable which contains some text

finals = display + splits[1]; // adding text to the second line

finals // applying the final text to this text layer.

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
LEGEND ,
Dec 05, 2020 Dec 05, 2020

Well, unless "splits" is defined as a function somewhere, this of course cannot work. You code does contain exactly zero actual string processing.

 

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 ,
Dec 06, 2020 Dec 06, 2020

I have tried the below also without splits still it doesn't work:

 

display = "this is amazing";
b = thisComp.layer("Test").text.sourceText.getStyleAt(0);
style = b;
style.setText(display) + "sometext";

 

but on the last line if i remove  +"sometext"; then it works such as :

style.setText(display)

 

In general it doesn't allow to add something once you apply the style. 

 

Is there any other way of doing, apply different styles to different lines 

 

 

 

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
LEGEND ,
Dec 06, 2020 Dec 06, 2020

Again, your code simply doesn't do anything because there is no real string processing and you're completely misunderstanding how those functions work. You might want to actually read the online help and also how strings are handled in JavaScript on a general level.

 

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 ,
Dec 06, 2020 Dec 06, 2020

Just to clarify the splits was defined as follows, i had omitted it just to show the code that was required

 

splits = textie.split("**");

 

The target is if the text comes in with a "**", we split it and any text coming after the "**" is displayed on the second line with a "\r" like below

 

display = splits[0] + "\r" + splits[1];

 

Now what we need to achieve is get the splits[1] with a different formatting (style then the original one) as in the pic below. So the text comes in as Spider Man**Far from Home, we get the Far from home in a 2nd line but with different formatting as show. Whats the best way to acheive this. 

 

goofy687_0-1607257445231.pngexpand image

 

 

 

 

 

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 ,
Dec 06, 2020 Dec 06, 2020

Unfortunately, AE doesn't currently have the option to apply styles via expressions.  To have two lines of text with different styles, you'll need to use two text layers.  What you might be able to do though, is have an "input" text layer, then have two different text layers and use near-identical expressions to split that text as you're doing, displaying splits[0] in one layer and splits[1] in the sub layer.

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 ,
Dec 06, 2020 Dec 06, 2020

Yes this is what i thought as a backup plan, but really wanted to get one layer working to keep the layers to a minimal and keep the project optimized. But will have to stick to this for now as AE has a limitation on expressions with style.

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 ,
Dec 05, 2020 Dec 05, 2020

If you're talking about text you can swipe over a line if text with the type tool and make changes through the character panel for that line. Repeat.

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 ,
Dec 05, 2020 Dec 05, 2020

Yes i know this part for manually doing it, how can i achieve the same using expressions of changing the style (font, color, size) for the same layer. I have double line (two lines), first line i need a different style, second line i need a different style but using expressions 

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 ,
Dec 06, 2020 Dec 06, 2020
LATEST

While line 1 of your Text Layer is actively selected, adjust the settings in the Chracter Panel and/or Paragraph Panel.  Then, select line 2 of your Text Layer and adjust the settings again.  

 

It works just like Photoshop if you've ever adjusted Text Layers in PS.

 

Another approach is to apply Text Animators, using Range Selectors to adjust the characters.

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