Skip to main content
mael32275969
Participant
Dec 9, 2024 5:44 AM UTC
Answered

Setting sourceText as well as kerning (character attribute)

Hi,

I've got a Text layer which is taking it's value from another layer "Rate" - first line of the code.

 

I want to be able to kern the characters of this individually (using sliders) but when I add in the code (lines 2 onwards), it no longer takes the "Rate" value but reverts to the original value

I'm not sure why it is happening. I think I need to redefine the sourceText value but I'm not sure how to do that.

 

Thanks in advance!

 

thisComp.layer("Rate").text.sourceText.value;

text.sourceText.style 
// 1st character kerning //
.setKerning(thisComp.layer("CONTROL").effect("1st Kerning multiplier")("Slider"), 1)
// 2nd character kerning //
.setKerning(thisComp.layer("CONTROL").effect("2nd Kerning multiplier")("Slider"), 2)
// 3rd character kerning //
.setKerning(thisComp.layer("CONTROL").effect("3rd Kerning multiplier")("Slider"), 3)

 

This topic is closed to new replies. Start a new post to keep the conversation going.
mael32275969
mael32275969Correct answer
Participant
Dec 9, 2024 10:17 PM UTC

Yay! It works! Thank you so much!! I didn't know about the .setText().

5 replies

mael32275969
Participant
Dec 9, 2024 5:54 AM UTC

Here is what I mean by what happens when I add in the 2nd line of code onwards. It doesn't take the "Rate" value anymore

Translate
Legend
Dec 9, 2024 7:33 AM UTC

you need to apply the setText() method:

 

txt = thisComp.layer("Rate").text.sourceText.value;

text.sourceText.style
// 1st character kerning //
.setKerning(thisComp.layer("CONTROL").effect("1st Kerning multiplier")("Slider"), 1)
// 2nd character kerning //
.setKerning(thisComp.layer("CONTROL").effect("2nd Kerning multiplier")("Slider"), 2)
// 3rd character kerning //
.setKerning(thisComp.layer("CONTROL").effect("3rd Kerning multiplier")("Slider"), 3)
// Attach the "Rate" value
.setText(txt)

 

 

Translate
mael32275969
Participant
Dec 9, 2024 10:19 PM UTC

Thank you so much!! I didn't know about the .setText().

Translate