Tutorial 65: Build an Advanced Text Paragraph Template in Cavalry

This tutorial is very similar to my previous text animation template tutorial here. It features about 80% of the same setup. With some changes, you can now animate entire paragraphs in similar fashion as before. Previous tutorial allowed you to animate text as a single line. It’s perfectly fine. But if you want to quickly animate loads of text, then it becomes problematic.

Component Constraint – our workhorse

Main idea behind this setup is the use of Component Constraint utility. This tool allows us to attach a shape or a layer to another mesh Point or Edge. By utilising Text Background shapes per character, we can easily attach other shapes to our Main Text with precision.

I’m using individual character background Index to attach our Highlight text to a bottom right corner. You can make more complex or different rigs – just need to change the Index value.

JS Math – our calculations behind workhorse

I hope I was able to explain logic behind JS Math. If not, let me expand on it here. Imagine a word “HELLO”:

  • 5 characters
  • Each character has a background box around it
  • Each box has 4 points
  • Each point has an ID – start at 0 and it goes up
  • 5 characters * 4 points = 20. Then subtract 1 and you have an array from 0 to 19
    • This array represents IDs for each Point in the Background Shape set to Character

If you want to attach a shape to bottom right corner of E you have to skip all the vertices on H + advance 1 on E. You are targeting Point Index 5 in this case. It goes like this (each letter has a background shape):

  • H
    • Bottom Left – 0
    • Bottom Right – 1 target this
    • Top Right – 2
    • Top Left – 3
  • E
    • Bottom Left – 4
    • Bottom Right – 5 target this
    • Top Right – 6
    • Top Left – 7
  • L
    • Bottom Left – 8
    • Bottom Right – 9 – target this
    • Top Right – 10
    • Top Left – 11
  • And so on …

With the above logic, you want to target specific IDs to advance your highlight, per character, as the String Resize animates from 0% – 100%. 1, 5, 9 and so on. This is where the JS Math comes in:

  • String Resize – 0% – 100%
    • Count Sub-Meshes – 1 – Total Number of Submeshes (automatically updates as String Resize does it’s thing, so we use this data)
  • Take Count Sub-Mesh – offset IDs by -1 to create “an array”
  • Multiply it by 4 – total number of indexes in each shape (Rectangles)
  • Advance it automatically as String Resize animates (Count Sub-Mesh goes up)

In my Gumroad File, you will see slightly different version, where I nested JS Math node inside JS Math Node that allows you to easily adjust, which index we are targeting (which corner). It was part of an early research. I left it out as it could be confusing for people not familiar with JS Math node.

Examples

Get Project File From Gumroad

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.

Found it helpful? Consider sharing it with others.

Other tutorials

2026-05-31T12:22:39+01:00
Go to Top