Tutorial 31: 5 Ways of adding Gradient to Text in Cavalry
Cavalry allows you to dynamically assign colours, filters (or effects in After Effects terms), shaders, gradients and more to text. However, if you want to target specific words, for example to highlight certain section, it requires a bit of a set up. In this video, I explore 5 ways of achieving this objective.
Method 1 – Visibility Sequence
This method involves using Custom Shape and Visibility Sequence behaviour. It works, by making a copy of your original text layer and hiding unnecessary words, letters etc.
Benefits:
- Custom Shape is an instance, so any changes made in a “master” tex layer will show up in Custom Shape
- You can add multiple Custom Shapes and “stack” multiple gradient shaders on top of each other
Downsides:
- You are dealing with 2 separate layers
- If you want to use Auto Animate to quickly animate your text, not all the animation modes will show up in the Custom Shape
- In my tests in Cavalry 2.4.3, Opacity was the one that was not showing up – position was working just fine, but Opacity animation was not showing up in the Instance
Method 2 – Apply Text Material
Apply Text Material was introduced in Cavalry 2.1. It is the main way you can add effects, Fills, Stroke, Shaders to text and target specific Indexes by Character, Words, Lines. Also, it supports RegEx, too.
Benefits:
- You are dealing with 1 Text Layer for the whole effect
- Auto-Animate works without problems
- You can target ranges of words from 1 layer
- Supports adding effects, like Glow, Dithering etc
Downsides:
- Gradient still spans each word at a time
- You need to use Screen Space in the Gradient Shader for this effect to work properly
Method 3 – Formatted Input
This method is using Text Shape's Formatting Input field. I really like this one, as you can easily format your text across 2 layers. Main text can have font A, with font size 100, colour red. Formatted text B can have font B, with font size 50 and gradient shader applied to it.
Benefits:
- 2 separate layers makes styling text a bit easier
- By using curly brackets and index number , you can insert same text string across multiple points within the paragraph
- This opens lots of opportunities for styled text that can be updated from one place
Downsides:
- You are dealing with 2 layers
- Apply Text Materials does not always work or "feeds through" from Text B to Text A in my tests
Method 4 – Index to Color
Apply Text Material was introduced in Cavalry 2.1. It is the main way you can add effects, Fills, Stroke, Shaders to text and target specific Indexes by Character, Words, Lines. Also, it supports RegEx, too.
Benefits:
- You are dealing with 1 Text Layer for the whole effect
- Auto-Animate works without problems
- You can target ranges of words from 1 layer
- Supports adding effects, like Glow, Dithering etc
Downsides:
- Gradient still spans each word at a time
- You need to use Screen Space in the Gradient Shader for this effect to work properly
Method 5 – Extract Sub-Mesh
This is a great method. Special thanks got to Yevgeny Makarov from Discord for working it out. By using Extract Sub-Mesh tool, we are essentially creating an exact copy from our Master Text layer. This is super useful, for things like Forge Dynamics animation.
Benefits:
- Perfect copy of a text layer that can be modified further, separately from main text
- Works great in Forge Dynamics setups
Downsides:
- Auto-Animate does not seem to work, when you use Flatten Shape Layers modifier
This project file contains all the assets necessary to make animation in the tutorial in final form. Everything is labeled, linked, with expressions and ready to use, if you wish to make your own version or just play around with it.
If you have any suggestions for tutorials or how I can improve, please do get in touch. I would love to hear from you.




