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

SourceText expression question

Community Beginner ,
Jan 30, 2020 Jan 30, 2020

Copy link to clipboard

Copied

Hi! I am beginner at expressions. I am tryed do next thing:

1. Get strings from CSV file with this code:

idx = parseInt(thisLayer.name.match(/\d+/),10)-1;
var stre=footage("news.csv").dataValue([idx,0]);

stre;

At this point all good - text strings from file correctly displayed in the composition.

After i am want change the font size at expression adding this:

2.

styleA = thisComp.layer("text2").text.sourceText.createStyle()
styleB = styleA.setFontSize(500);
styleB;

The font size changes, but the text in the composition is replaced with the original text " Text2".

I am think that i am need to be add code that change value of SourceText at this expression. But i am beginner and don't know how fix it. Please help me! Thank you very much!

 

TOPICS
Expressions , How to

Views

527

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
LEGEND ,
Jan 31, 2020 Jan 31, 2020

Copy link to clipboard

Copied

Presumably it's gonna be stre.setStyle(MyStyle) or something like that... No idea, though. Not on 2020 for technical reasons.

 

Mylenium

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
Advisor ,
Jan 31, 2020 Jan 31, 2020

Copy link to clipboard

Copied

Try:

 

styleA = thisComp.layer("text2").text.sourceText.getStyleAt(0);
styleB = styleA.setFontSize(500)

 

 

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 Beginner ,
Feb 02, 2020 Feb 02, 2020

Copy link to clipboard

Copied

Thank! But it not work (

This code return the original source text at layer (not from CSV string), but style is changing succesfully.

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
Advisor ,
Feb 02, 2020 Feb 02, 2020

Copy link to clipboard

Copied

Can you upload a screen shot of your timeline? Select the two layers you are working with and type "UU". This will show the expressions. Drag the lower boundary down to make sure we can see the full expression.

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 Beginner ,
Feb 03, 2020 Feb 03, 2020

Copy link to clipboard

Copied

I wanted do next: load text from file to text layer and resize the font depended from lenght of text (3 sizes of text).

This problem - "text.sourceText" always has is original text inside. It can change only via JavaScrupt (SetValue). Styles ignoring all, but not a SourceText. I am fixed issue by this  way:

1. Make a 3 dublicates of text layers with difference font size.

2. Write expression at transform.Opacity with same algorithm. Read string from file, read lenght of string and make the "if-else" from lenght for opacity variable.

 

Sorry my english. Thank!

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 Beginner ,
Mar 06, 2020 Mar 06, 2020

Copy link to clipboard

Copied

I have the same issue did you solved it?

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
Contributor ,
Mar 09, 2020 Mar 09, 2020

Copy link to clipboard

Copied

LATEST

It's not works the way how you assumed. There is setText Property to push your text into style line. It's so simple.... You just need to add this line after your code.

createStyle().setText(stre).setFontSize(500);

 

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