Copy link to clipboard
Copied
I can't change any text properties of a text using the STYLE commands.
I must be using it totally wrong.
Why doesn't this work?
thisLayer.text.sourceText.setFontSize(50);
Whatever the syntax of the STYLE commands is, I find it completely incomprehensible.
None of the documentation on the internet works for me.
Even chatgpt gave up.
Is there anyone who can show in babysteps how to set omething correctly?
(please mark variables with a _ somewhere or else I get confused to see variables among the commandos)
Copy link to clipboard
Copied
motiondeveloper .com says this:
This is partly because they break one of the unwritten "rules" of expressions, which is that expressions can only set the value for the property they're on.
I do not even understand that. I feel I'm so close but where are the cigars?
Copy link to clipboard
Copied
Try this:
style.setFontSize(50)
then this:
style.setFontSize(50).setText("new text")
That should help you get the hang of how it works.
Copy link to clipboard
Copied
As Dan has suggested, you need to start your text styling with a "style" syntax. There are only TWO ways you will really use te style syntax - (1) Reference another Text Layer's Style (2) Reference the Current Text Layer's Style.
You use "style" when referencing the Current Text Layer. When referencing Another Text Layer's Style, you MUST reference that layer and its style - like this -
textStyleFromAnotherLayer = thisComp.layer("HeaderText").text.sourceText.style;
IMPORTANT to take note you have to reference the other layer's text.sourceText.style attribute, in full.
When referencing the Current Text Layer's Style, you do not have to reference text.sourceText UNLESS you want to reference it by changing its text string and this is usually done before declaring the style statement/code.
So, in your case, all that is required is -
style.setFontSize(50)
HTH