---
title: "How to add a letter-spacing animation with Claude (tested prompt and script)"
description: "\"RADIANT\" in white capitals fades in above the bottle with its letters packed tight, then the gaps between them slowly open until the word stretches across most of the frame. Install one skill and ask Claude Code, or run the Python script we tested yourself."
url: https://www.recharm.com/effects/text-tracking-animation
---

# How to add a letter-spacing animation with Claude

"RADIANT" in white capitals fades in above the bottle with its letters packed tight, then the gaps between them slowly open until the word stretches across most of the frame.

Made by the script on this page, from our own test clip.

## Get this effect

1. ### Switch to Code in your [Claude Desktop App](https://claude.com/download)

2. ### Install the skill (once)

   ```
   Install the Recharm video effects skill: download https://recharm-growth-staging.s3.us-east-2.amazonaws.com/website/downloads/recharm-video-effects.zip and unzip it into ~/.claude/skills
   ```

3. ### Ask for the effect

   ```
   Add a letter-spacing animation to input.mp4
   Text: RADIANT
   ```

## Several videos, several effects, one ask

Put your clips in the folder, mention them with @, and ask for everything at once. Claude runs one tested script after another on each clip, then joins them.

Add a letter-spacing animation to **@clip1.mp4**, put a sale badge on **@clip2.mp4**, give **@clip3.mp4** a VHS look, then join all three with crossfades.

## Settings you can change

Ask Claude to change any of these, or edit them at the top of the script.

| Setting  | Default           | What it does                                                     |
| -------- | ----------------- | ---------------------------------------------------------------- |
| `TEXT`   | `RADIANT`         | The title.                                                       |
| `START`  | `0.5`             | Second the title starts fading in and spreading.                 |
| `FADE`   | `0.8`             | Seconds the fade in takes.                                       |
| `SPREAD` | `3.5`             | Seconds the letters take to spread to their widest.              |
| `GAP`    | `-0.05, 0.5`      | Gap between letters, in font sizes, before and after the spread. |
| `SIZE`   | `0.11`            | Font size as a share of the frame width.                         |
| `Y`      | `0.15`            | Title center, 0-1 down the frame.                                |
| `COLOR`  | `(255, 255, 255)` | Text color.                                                      |
| `SHADOW` | `(40, 20, 60)`    | Soft shadow color behind the letters.                            |

## Without the skill

Don’t want to install the skill? Paste this prompt into Claude Code and Claude writes the script itself.

```
Add a letter-spacing (tracking) animation to input.mp4 (540x960): the word "RADIANT" in white (255, 255, 255) Arial Bold (or any bold sans-serif), font size 59 pixels (11% of the frame width), centered horizontally with its vertical middle 144 pixels down (15% of the height). Draw it letter by letter. The gap between letters starts at -3 pixels (-0.05 times the font size, so the letters nearly touch) and widens to 29.5 pixels (0.5 times the font size) between 0.5 and 4.0 seconds, with sine ease-in-out easing ((1 - cos(pi * p)) / 2), then stays at that width to the end; the word stays centered as it widens. The word fades in linearly from invisible at 0.5 seconds to full opacity at 1.3 seconds and stays to the end. Behind the letters put a soft dark plum (40, 20, 60) shadow: the letter shapes blurred with a 5-pixel Gaussian blur at 90% opacity, fading with the text. Before 0.5 seconds the frame is untouched, and nothing below the title ever changes. Use Python with Pillow to draw the text (don't rely on ffmpeg's drawtext filter) and ffmpeg to put it on the video, keep the audio, the 30fps and the 6 second length, and save it as output.mp4.
```

## Run it without Claude

This is the exact script we tested. Save it as `text-tracking-animation.py` and run:

```
python3 text-tracking-animation.py input.mp4 output.mp4
```

```
#!/usr/bin/env python3
"""Letter-spacing animation: a title fades in with its letters packed tight, then they slowly spread wide apart.

Usage: python3 text-tracking-animation.py input.mp4 output.mp4
Needs ffmpeg and Pillow (pip install pillow).
"""
import json
import math
import subprocess
import sys
from pathlib import Path

from PIL import Image, ImageDraw, ImageFilter, ImageFont

TEXT = "RADIANT"             # the title
START = 0.5                  # second the title starts fading in and spreading
FADE = 0.8                   # seconds the fade in takes
SPREAD = 3.5                 # seconds the letters take to spread to their widest
GAP = -0.05, 0.5             # gap between letters, in font sizes, before and after the spread
SIZE = 0.11                  # font size as a share of the frame width
Y = 0.15                     # title center (0-1 down the frame)
COLOR = (255, 255, 255)      # text color
SHADOW = (40, 20, 60)        # soft shadow color behind the letters
FONTS = ["/System/Library/Fonts/Supplemental/Arial Bold.ttf",        # macOS
         "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf",     # Linux
         "C:/Windows/Fonts/arialbd.ttf"]                            # Windows
FONT_FILE = next((f for f in FONTS if Path(f).exists()), None) or sys.exit("No bold font found: add one to FONTS")

def progress(t, start, length):
    """0 before start, 1 after start + length, eased in and out between."""
    p = min(max((t - start) / length, 0), 1)
    return (1 - math.cos(math.pi * p)) / 2

def letters(t):
    """The title drawn on a clear layer, with the letter gap for time t."""
    layer = Image.new("RGBA", (w, h))
    draw = ImageDraw.Draw(layer)
    gap = font.size * (GAP[0] + (GAP[1] - GAP[0]) * progress(t, START, SPREAD))
    widths = [draw.textlength(ch, font=font) for ch in TEXT]
    x = (w - sum(widths) - gap * (len(TEXT) - 1)) / 2
    for ch, cw in zip(TEXT, widths):
        draw.text((x, h * Y), ch, font=font, anchor="lm", fill=COLOR)
        x += cw + gap
    return layer

def overlay(t):
    alpha = min(max((t - START) / FADE, 0), 1)
    img = Image.new("RGBA", (w, h))
    if alpha:
        text = letters(t)
        shadow = Image.new("RGBA", (w, h), SHADOW)
        shadow.putalpha(text.getchannel("A").filter(ImageFilter.GaussianBlur(5)).point(lambda a: a * 0.9))
        img = Image.alpha_composite(shadow, text)
        img.putalpha(img.getchannel("A").point(lambda a: round(a * alpha)))
    return img

def probe(path):
    info = json.loads(subprocess.check_output(["ffprobe", "-v", "error", "-select_streams", "v:0", "-show_entries",
                                               "stream=width,height,r_frame_rate:format=duration", "-of", "json", path]))
    s = info["streams"][0]
    num, den = s["r_frame_rate"].split("/")
    return s["width"], s["height"], s["r_frame_rate"], float(num) / float(den), float(info["format"]["duration"])

def render(src, out):
    """Draw overlay(t) on every frame of src and save to out, keeping the audio."""
    ff = subprocess.Popen(["ffmpeg", "-y", "-v", "error", "-i", src,
                           "-f", "rawvideo", "-pix_fmt", "rgba", "-s", f"{w}x{h}", "-r", rate, "-i", "-",
                           "-filter_complex", "[0:v][1:v]overlay=shortest=1,format=yuv420p[v]",
                           "-map", "[v]", "-map", "0:a?", "-c:v", "libx264", "-crf", "18", "-c:a", "copy", out],
                          stdin=subprocess.PIPE)
    for i in range(math.ceil(duration * fps)):
        ff.stdin.write(overlay(i / fps).tobytes())
    ff.stdin.close()
    if ff.wait():
        sys.exit("ffmpeg failed")

src, out = sys.argv[1:3]
w, h, rate, fps, duration = probe(src)
font = ImageFont.truetype(FONT_FILE, round(w * SIZE))
render(src, out)
```

## More text and titles

- [Animated text frame **Animated text frame**](https://www.recharm.com/effects/animated-text-frame)
- [Brush stroke text reveal **Brush stroke text reveal**](https://www.recharm.com/effects/brush-stroke-text-reveal)
- [Burning text **Burning text**](https://www.recharm.com/effects/burning-text)
- [Drop shadow text **Drop shadow text**](https://www.recharm.com/effects/drop-shadow-text)
- [Echo text **Echo text**](https://www.recharm.com/effects/echo-text)

## Find 3x _winning ads_

Recharm cuts your ad footage into tagged, searchable clips: hooks, testimonials, product shots. Find the shots that win, add the effect with Claude, and ship 3x more ad edits.

[Start 14-day free trial](https://www.recharm.com/get-started)
