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!
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
Copy link to clipboard
Copied
Try:
styleA = thisComp.layer("text2").text.sourceText.getStyleAt(0);
styleB = styleA.setFontSize(500)
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.
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.
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!
Copy link to clipboard
Copied
I have the same issue did you solved it?
Copy link to clipboard
Copied
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);