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

Now in Beta: Per-character Text and Paragraph Styling in Expressions

Adobe Employee ,
May 17, 2024 May 17, 2024

Copy link to clipboard

Copied

Hi everyone! 

 

We're excited to announce that starting in version 24.5.0x41 of After Effects Beta introduces support for per-character control of text and paragraph styling in Expressions. 

 

This long-requested addition to Expressions builds on recent per-character scripting API updates to unlock powerful text styling capabilities that are able to respond to changes in text content and can be saved and shared as presets. These new options can also streamline template design by making it possible to configure alignment and paragraph styling in a single layer rather than turning on and off multiple synced copies of a layer. 

 

A benefit of per-character control is automatic reflowing of text such as when scaling letters, using superscript, and using a different font, just as you would expect from using substring styling from the Character panel. 

 

Stretchy Text1.gif

Getting Started 

 

Make sure you have your expression engine set to Javascript. 

 

The Expression reference flyout menu provides an overview of available methods in the updated Text > Styling submenu; see the attached document for the full API. 

 

Text_Styles_Menu.gif

Sample Expressions 

 

Change the font for certain words 

Change_fonts.png

 

Using the string: “Change the fonts of some words” apply the following to the Source Text

 

 

text.sourceText.style
.setFont("Montserrat-Light") 
.setFont("Gigantic", 0, 6).setFont("Gigantic", 10, 6).setFont("Gigantic", 20) 

 

 

To customize this for yourself, change the font from the Text Expression flyout menu, and target the character index and amount of characters to make a different font. 

 

Set the first line of a text layer to bold and make it larger 

change_to_bold.png


Using the string: “Change the first line of text to bold and make it larger”
 apply the following to the Source Text

 

 text.sourceText.style.setFontSize(100, 0, 30).setFauxBold(true, 0, 30) 

 

 

 Set superscript for characters 

set_superscript.png

 

Using the string: “1st and 2nd Place”  apply the following to the Source Text

 

 

text.sourceText.style.setBaselineOption("superscript",1,2).setBaselineOption("superscript", 9, 2) 

 

 

Try passing character index values and character amounts to expression sliders and using keyframes to create animation! 

 

Known Issues 
 

  1. There is a difference in behavior when using .setJustification between Left to Right text and Right to Left text. To justify text to the left when using RTL, use .setJustification("alignRight"), and to justify to the right, use .setJustification("alignLeft"). 
  2. When exporting a mogrt, using .setFontSize() and enabling Font Size adjustment in Font Properties causes unexpected behavior in Premiere Pro. It’s recommended to use one or the other, but not both together. 

  

Limitations  

The style object always returns the first character's style information, not the characters' individual substyles. Therefore, when reading the style of a Text layer containing multiple styles, you must use getStyleAt() with a character index to specify which character's style you need. 

 

We've built an example AEP with the above expressions and few extras to get you started. Please give all of these new expressions a try and let us know how they’re working for you!

TOPICS
Feature request , Performance

Views

9.2K

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
Valorous Hero ,
Sep 05, 2024 Sep 05, 2024

Copy link to clipboard

Copied

Cool! Thanks for sharing. Always good to see the work of others.  

Very Advanced After Effects Training | Adaptive & Responsive Toolkits | Intelligent Design Assets (IDAs) | MoGraph Design System DEV

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
Valorous Hero ,
Jun 13, 2024 Jun 13, 2024

Copy link to clipboard

Copied

On Number of Lines for Paragraph Text, I've always wondered why internally this number is available via the Range Selector when you switch Units from Percentage @ 100% to Character Index but it's been like locked away from Expressions. 

It'll be great if this (numberOfLines thingy) is accessible via a function/method and directly used within the Start/End Range Selectors in a straightforward manner.   

Very Advanced After Effects Training | Adaptive & Responsive Toolkits | Intelligent Design Assets (IDAs) | MoGraph Design System DEV

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 ,
Sep 04, 2024 Sep 04, 2024

Copy link to clipboard

Copied

This looks amazing, we've been waiting to be able to do this for ages.. 

Is there any news on when it will be available in the release version of AE?

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
New Here ,
Sep 19, 2024 Sep 19, 2024

Copy link to clipboard

Copied

Yes! Hyped for this. I've updated Motion Developers `style-parser` to use these new beta features, check out the PR/example project file. Shoutout to @Volition74au for commenting the `eval()` code snippets in this thread!

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
Participant ,
Oct 07, 2024 Oct 07, 2024

Copy link to clipboard

Copied

Have feedback for setJustification()

 

Using this expression copies all Style settings from "Text 1", including paragraph justification.

thisComp.layer("Text 1").text.sourceText.style

Example 1.gif

However, the expression below copies Style settings, sets Text, and then throws away the paragraph justification set via Style.

thisComp.layer("Text 1").text.sourceText.style.setText(thisComp.layer("Text 1").text.sourceText)

Example 2.gif

This is inconsistent behavior compared to all the other style attributes. Doesn't make sense for Justification to be ignored, unless it is explicitly overrode later in the chain.

 

It is also inconvenient.

 

I kept the expressions barebones so this is clear.

 

Request:

Please match the established behavior for all Style attributes. ".style" should copy all style attributes unless overridden later in the chain.

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 ,
Oct 16, 2024 Oct 16, 2024

Copy link to clipboard

Copied

A mix of setHorizontalScaling, setBaselineShift, setFillColor

AE_2025.gif

 

AE_2025_2.gif

 

AE_2025_4.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
Valorous Hero ,
Oct 17, 2024 Oct 17, 2024

Copy link to clipboard

Copied

The sample below was done entirely with Text Animators.

I see the new styling features more for non-animation use-cases. There is definitely opportunity to explore creative options in the area for sure. 

Congrats to the team on getting this out - such a huge task. 


Very Advanced After Effects Training | Adaptive & Responsive Toolkits | Intelligent Design Assets (IDAs) | MoGraph Design System DEV

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 ,
Oct 17, 2024 Oct 17, 2024

Copy link to clipboard

Copied

@therethere  Would it be possible to add a javascript method to access the transform properties of the character bounding boxes that appear when Per-character 3D is enabled?

 

screenshot.png

 

This way we'll be able to create very dynamic/reactive text effects like this:

rec.gif

 

Currently, it can be done in After Effects by converting the text into shape layer, but it's tedious, the text is no longer editable, and you have to apply expressions to all the shapes, which causes it to lag very quickly.

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
Valorous Hero ,
Oct 17, 2024 Oct 17, 2024

Copy link to clipboard

Copied

This Reactive Effect uses Text Animators. 

Very Advanced After Effects Training | Adaptive & Responsive Toolkits | Intelligent Design Assets (IDAs) | MoGraph Design System DEV

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 ,
Oct 17, 2024 Oct 17, 2024

Copy link to clipboard

Copied

@Roland Kahlenberg  Yes, but it's still very limited and linear.

Look at the example above, the letters move in all directions based on the angle and the distance they have from the mouse cursor, and for that, you absolutely need to know the position of each letter.

And it makes things simpler the animation above is 60 lines of code. 

https://jsfiddle.net/Airweb/ug03ovtx/

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
Valorous Hero ,
Oct 17, 2024 Oct 17, 2024

Copy link to clipboard

Copied

You did ask about proximity.  🙂

So, yes you can do it with AE's Text Animators. The example you provided requires Affected Characters knowing the relative position of the Effector. And if the Effector is [above, below,noDifference] the Affected Characters will move differently. I've tried this but it's been a while - I'm quite certain I managed to pull it off or at least the Text Animators did do the job.

On the example you shared, in AE, I would break up the paragraph into individual lines - quite easy to do with Javascript String Manipulation - single paragraph input and then have each Text Layer/Line grab its text string/line. All the Proximity Code will be identical so this helps simplify the set up too. 

And it's dangerous to compare with JS Text Tools on the web cos they can do amazing stuff and very quickly too. And of course, per character Rect Boundary, be default is always good to have. And there are Particle Generators in AE that may provide an efficient solution to the sample you shared.

A while back, I shared the AEP to the sample I shared. If you want to take a look, I can dig it up and post it on my site.



Very Advanced After Effects Training | Adaptive & Responsive Toolkits | Intelligent Design Assets (IDAs) | MoGraph Design System DEV

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
Explorer ,
Oct 24, 2024 Oct 24, 2024

Copy link to clipboard

Copied

Hello! Nice to see what expression on text could do now, thanks for that update!
I'm wondering, is it possible to set with expression text direction ? (Right to Left, Left to right) for examle - for arabic language...
If not, could you add this feature ?)

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
Participant ,
Oct 24, 2024 Oct 24, 2024

Copy link to clipboard

Copied

@Oleh BetterMe  Yes, you can set expression text direction (LTR/RTL) with:

style.setDirection("left-to-right");
style.setDirection("right-to-left");

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
Explorer ,
Oct 24, 2024 Oct 24, 2024

Copy link to clipboard

Copied

LATEST

Amazing, thanks!

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
Explorer ,
Oct 24, 2024 Oct 24, 2024

Copy link to clipboard

Copied

Thank you! your attached ae proj. is of a great help.

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
Resources