# Colorful Text

This activity uses TouchDesigner. Please see the TouchDesigner section at the end of the menu on the left for more information about the program.

{% hint style="warning" %}
New TouchDesigner projects open with an example project. Please highlight and delete those operators so the project is empty.
{% endhint %}

## Goal

The goal of this activity is to create text that has an interesting random color changing effect.

## Step 1: Add Text

### Add the first text operator

Press the Tab key or right-click and select **Add Operator** to bring up the OP Create Dialog.

2D Text is a flat image, so we want the purple texture operators (TOPs).

Search for and select the Text TOP:

![](https://4077345522-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFloEXqUun2rk6R28rU%2F-ML-xSvl9P8I2IPEtRn7%2F-ML-zRanpY_KoMRgDKmd%2Fimage.png?alt=media\&token=c0c00534-a385-400d-88ad-d014a0360b8e)

Click to place the operator.&#x20;

![Default Text TOP and its parameters](https://4077345522-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFloEXqUun2rk6R28rU%2F-ML-xSvl9P8I2IPEtRn7%2F-ML-zb8dy2gGdKt0fcat%2Fimage.png?alt=media\&token=6214e58c-8b5b-4b3d-9866-827a22e62811)

{% hint style="info" %}
If you don't see the parameters when you click on the operator/node, press the P key or right-click and select **Parameters** to toggle the window.
{% endhint %}

### Adjust the resolution of the operator

The default resolution (under the Common tab) is 256 x 256.&#x20;

![](https://4077345522-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFloEXqUun2rk6R28rU%2F-ML-xSvl9P8I2IPEtRn7%2F-ML0-PWVMsnOn1AN5VWb%2Fimage.png?alt=media\&token=1e9993e7-5e79-40e2-84d2-80da353865ae)

We want this to be the resolution of our screen (or the largest one we can do with a free version: 1280 x 720).

Use the drop down arrow to the right of the Resolution to select the resolution you want or type it in.

![](https://4077345522-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFloEXqUun2rk6R28rU%2F-ML-xSvl9P8I2IPEtRn7%2F-ML0-lhaz6hxG9Tk6QsO%2Fimage.png?alt=media\&token=79301986-2a29-498e-b4e3-87d696b0b68b)

This makes the text in the operator small, but we can increase the text size.

![](https://4077345522-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFloEXqUun2rk6R28rU%2F-ML-xSvl9P8I2IPEtRn7%2F-ML000MaCmixpVptd-B2%2Fimage.png?alt=media\&token=923b8df5-8e90-42f7-8c7b-93d8ef94263a)

### Adjust the font parameters

Under the Font tab, you can update the font face, style, size, alignment, etc. As you update the parameters, you can see how it looks in the operator.

![](https://4077345522-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFloEXqUun2rk6R28rU%2F-ML-xSvl9P8I2IPEtRn7%2F-ML013d_RqfsWCte5D9O%2Fimage.png?alt=media\&token=6a806b6b-31ce-4f1e-804b-9cd5f97cb22d)

To change the text, update the Text parameter under the Text tab.

![](https://4077345522-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFloEXqUun2rk6R28rU%2F-ML016f9HJZPSroe76LV%2F-ML01Pd0KYWyG1436Jim%2Fimage.png?alt=media\&token=e6c7d498-9f6b-4394-ba76-8c097226ca86)

Once you're happy with the style, copy the operator (CTRL+C or right-click and select Copy) and paste (CTRL+V or right-click and select Paste) as many lines or sections you plan to have.

Update the text and font to match your needs.

![](https://4077345522-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFloEXqUun2rk6R28rU%2F-ML016f9HJZPSroe76LV%2F-ML025u_iFl6o5GD--LP%2Fimage.png?alt=media\&token=6fe608bf-82c2-48e3-a07c-6fe0359f254e)

## Step 2: Position Text

Now, we want to _move_ or _translate_ our text sections into the correct positions.

{% hint style="info" %}
You can move text using the Position parameter, but sometimes a Transform TOP provides more control.&#x20;
{% endhint %}

Let's use a Transform TOP!

Since the text is purple, we should stay with that color. On each output, right-click and select Transform.

![](https://4077345522-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFloEXqUun2rk6R28rU%2F-ML02S9AlFNwE5YcZmDj%2F-ML08jx76tWErvoBrVNn%2Fimage.png?alt=media\&token=233ea6dd-8e74-4e1e-aee3-78041a440a61)

Click to place the operator. It will use the resolution of the input.

![](https://4077345522-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFloEXqUun2rk6R28rU%2F-ML02S9AlFNwE5YcZmDj%2F-ML09-dJMREKQ98tmuzb%2Fimage.png?alt=media\&token=8c2cd603-afb6-4e66-9c62-27cf657ca327)

Select the Transform TOP of the text you want to position and change the parameters for Translate and Rotate to position the section of text.

If you click and drag on the value you want to change with your middle/scroll button, it will bring up a list of increments. Hover over the increment you want and move right to increase and left to decrease.

![](https://4077345522-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFloEXqUun2rk6R28rU%2F-ML02S9AlFNwE5YcZmDj%2F-ML0AhvkeiY1R30e4oTN%2FWeek9Bs2.gif?alt=media\&token=6e09c8b6-a256-479d-840f-bed0b96005b3)

## Step 3: Combine the Operators to "Layer" the Text

It will be easier to see the positioning if we have the text sections all in one operator. Let's use a Composite TOP to bring in all these operators and create one node to later display.

In an empty space to the right of the operators, press TAB or right-click and select **Add Operator** to bring up the OP Create Dialog. Search for and select the Composite TOP.

![](https://4077345522-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFloEXqUun2rk6R28rU%2F-ML02S9AlFNwE5YcZmDj%2F-ML0BYMGTC2wgA4wBUYg%2Fimage.png?alt=media\&token=70dcf159-ba34-46ed-a628-d8ed9261b6f8)

Click to place the operator.

Using your right button, click and drag to select the Transform TOPs.&#x20;

Left-click and drag from one of the Transform TOP outputs to the input of the Composite TOP. All the selected TOPs will connect to the Composite TOP.

![](https://4077345522-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFloEXqUun2rk6R28rU%2F-ML0C_sFkfHqBNjxm0tv%2F-ML0Do6CcEstsZatkQ4U%2FWeek9Bs3.gif?alt=media\&token=2a3d2434-fbea-43c2-98d2-90b1802dfb8b)

The Composite TOP's Operation parameter is Multiply by default, so the operator will appear blank. Change the Operation to Over to see the text. This is like using a Blending Mode with layers in Photoshop.

![](https://4077345522-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFloEXqUun2rk6R28rU%2F-ML0C_sFkfHqBNjxm0tv%2F-ML0DwCRsHFYIf1nabdL%2Fimage.png?alt=media\&token=2b2f5773-d03b-484d-bd99-49ad35e37032)

## Step 4: Seeing a Display

You can see a display of a texture operator (TOP) by toggling the blue Display dot on the bottom right of the operator.

![](https://4077345522-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFloEXqUun2rk6R28rU%2F-ML0C_sFkfHqBNjxm0tv%2F-ML0ETNE3i6uxHIUQ_yc%2Fimage.png?alt=media\&token=be78ca42-6013-4e01-8cb5-33a40bf6e2ab)

But to see a more accurate view of a final display, use a Null and Out TOP.

A **Null** operator is like a snapshot of progress.

Right-click on the Composite TOP output and add a Null TOP.

The project is looking for a texture operator named "out1" by default to display. Add this by right-clicking on the output of the Null TOP and add an Out TOP.

![](https://4077345522-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFloEXqUun2rk6R28rU%2F-ML0C_sFkfHqBNjxm0tv%2F-ML0FS-yHRHzw7U60PQP%2Fimage.png?alt=media\&token=ff50747c-278a-4b36-b0b9-fccd59599bca)

Now, you can preview what this looks like by clicking the Open Viewer button at the top left (looks like a square).

![](https://4077345522-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFloEXqUun2rk6R28rU%2F-ML0C_sFkfHqBNjxm0tv%2F-ML0Fg9GiqLRbfwMcRwf%2Fimage.png?alt=media\&token=d378819c-c49e-4006-9023-ae01b1624ab9)

This will make it easier to see your text position.

## Step 5: Add Some Noise (Random Color)

Texture, surface, and channel tops all have random operators named "Noise."

We could use a Constant TOP for a single color, but let's go for a randomized rainbow.

Below the text, add a standalone Noise TOP.

![](https://4077345522-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFloEXqUun2rk6R28rU%2F-ML0Fpwv22rFVUx3UO5l%2F-ML0GQxiI1FuTlrw-LPz%2Fimage.png?alt=media\&token=8acdacf4-0fe5-4ed3-8ae1-7c7231a8765b)

It defaults to a 256 x 256 random monochrome image.

### Correct the Resolution

Bump up the Resolution to match that of our project using the Resolution parameter under the Common tab.

![](https://4077345522-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFloEXqUun2rk6R28rU%2F-ML0Fpwv22rFVUx3UO5l%2F-ML0Gpd4MZRgHJJjSp2X%2Fimage.png?alt=media\&token=5e0f89cb-84dd-4c45-a89e-8d494be994b4)

### Switch to Color

Under the Noise tab, turn off Monochrome.

![](https://4077345522-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFloEXqUun2rk6R28rU%2F-ML0Fpwv22rFVUx3UO5l%2F-ML0HAzvDeSDBPfVDCrd%2Fimage.png?alt=media\&token=13dc17f9-5c1d-429e-b22f-1c70f6b30bf8)

You can change the look by changing the values, but it is static.

To get some movement, we can use the absTime (absolute time) class and a Python expression.

For the Harmonic Gain parameter, click on the name of the parameter to have it show more info. Click the cyan square and type in the following:

```python
absTime.seconds/5000
```

You can change the 5000 value to another number to see the effects on speed.

![](https://4077345522-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFloEXqUun2rk6R28rU%2F-ML0Fpwv22rFVUx3UO5l%2F-ML0J4fA5VodI6nX9XdO%2FWeek9Bs5.gif?alt=media\&token=3356ff15-539d-4462-9ecc-ee9bd9a3b7bc)

## Step 6: Add This Color to the Text

Since the text is white, we can just use a Composite TOP and its multiply operation to color the text.

Create another Composite TOP.

Right-click and drag to select the Null TOP and the Noise TOP. Left-click and drag from the output of one of the selected TOPs to the input of the Composite TOP.

Add a Null TOP after the Composite TOP.

Then, click and drag from the output of the new Null TOP to the line going into the Out TOP to replace the connection.

![](https://4077345522-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFloEXqUun2rk6R28rU%2F-ML0JH1AfgYaJtbB3pk3%2F-ML0La4uSgeYjWqqwqkn%2FWeek9Bs6.gif?alt=media\&token=560dd367-22ea-4fac-98ec-a15ccad821cc)

By default, where it is transparent will be black, but if you want it DEFINATELY black, the second Null TOP can be layered over a black Constant TOP (remember to bump up the resolution) with another Composite TOP (use the Over operation).&#x20;

![](https://4077345522-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFloEXqUun2rk6R28rU%2F-ML0JH1AfgYaJtbB3pk3%2F-ML0Md-jS5flOldkWq2Z%2Fimage.png?alt=media\&token=ebb05f86-9171-43ad-9750-3de13625bc71)
