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

Setting sourceText as well as kerning (character attribute)

Community Beginner ,
Dec 08, 2024 Dec 08, 2024

Copy link to clipboard

Copied

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)

 

TOPICS
Expressions

Views

81

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

correct answers 2 Correct answers

Advocate , Dec 08, 2024 Dec 08, 2024

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)

 

 

Votes

Translate

Translate
Community Beginner , Dec 09, 2024 Dec 09, 2024

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

Votes

Translate

Translate
Community Beginner ,
Dec 08, 2024 Dec 08, 2024

Copy link to clipboard

Copied

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

code-ref.gif

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
Advocate ,
Dec 08, 2024 Dec 08, 2024

Copy link to clipboard

Copied

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)

 

 

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 ,
Dec 09, 2024 Dec 09, 2024

Copy link to clipboard

Copied

LATEST

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

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 Expert ,
Dec 08, 2024 Dec 08, 2024

Copy link to clipboard

Copied

I think you just need a slight change:

txt = thisComp.layer("Rate").text.sourceText.value;
text.sourceText.style 
.setKerning(thisComp.layer("CONTROL").effect("1st Kerning multiplier")("Slider"), 1)
.setKerning(thisComp.layer("CONTROL").effect("2nd Kerning multiplier")("Slider"), 2)
.setKerning(thisComp.layer("CONTROL").effect("3rd Kerning multiplier")("Slider"), 3)
.setText(txt)

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 ,
Dec 09, 2024 Dec 09, 2024

Copy link to clipboard

Copied

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

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