The Decompose Text node is perhaps the most useful node for text animation in Animation Nodes. The node takes a text as input and decomposes it into characters or words, returning some information about those characters or words such as their transforms, texts, and count. Those information can then be be manipulated and animated using the many facilities provided by Animation Nodes.
For instance, given the text cat
in characters mode, the node will return the
following:
c
, a
, and t
.In this tutorial, a number of examples are provided to demonstrate the capabilities of this node.
The most basic use of this node is as follows. A number of text objects are
instantiated, their texts are set using the output texts of the node, their
fonts are set using the input font, and their transforms are set using the
output transforms of the node. Since each font have its own typographic
properties, the font has to be provided to the node and set to the output
objects, failure to do so would result in erroneous spacing. The built-in
BFont
font can not be used due to technical limitations, but it is also a
sign from the universe that you shouldn’t use that font in your work.
The node parameters are straightforward. The reader is encouraged to adjust the parameters of the basic setup to get a basic idea of what they control.
CENTER
, LEFT
, and RIGHT
.Most of those parameters are vectorized and virtual, meaning you can specify those parameters per character, word, or line by providing lists.
The following examples demonstrate vectorized parameters.
The most basic text animation to create with this node is as follows. An Offset Matrix node is used to offset the scale of the characters based on an inverted Delay Falloff with a back interpolation.
This animation can be extended to include rotation and location offsets as follows.
The animation can be extended further to incorporate a leaving animation as follows. The input time of the delay falloff is ping ponged to decrease again after a certain amount of time. A compare and switch tree is used to change the rotation and location offsets depending on whether the animation is in its first or second part.
In this example, the offsets of the Delay Falloff node are controlled by shuffled linearly distributed values. This results in each character appearing at a random point in time. The animation is ping ponged to add a disappearance animation. The seed of the shuffle node is the result of the floor division of the time by the ping pong period, this means that it will be zero in the first part of the animation and one in the second part.
It is possible to animate the node parameters directly. In this example, the size of characters is controlled in a manner similar to the one described in the previous example. This is different from the previous example in that the size parameter affects the positions of the characters, while offsetting the scale in the output matrix will only affect the scale.
In this example, we also animate the parameters directly by setting the character spacing to the values of a delay falloff with a bouncy interpolation. The falloff values are multiply by a factor that determine the distance they will travel and a value of one is eventually added because the default base value of character spacing is one.
In this example, the character sizes are controlled by the values of a remapped cosine wave with an animated phase.
In this example, an empty is animated along a path and an action is constructed from its animation data. The matrices are offset based on that action using a delay falloff as an offset.