How to add a handwriting animation with Claude

"Pure glow" writes itself across the top in deep violet handwriting, letter by letter from left to right, as if an unseen pen were inking it.

Get this effect

  1. Switch to Code in your Claude Desktop App

  2. Install the skill (once)

    Show the prompt
    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 handwriting animation to input.mp4
    Text: Pure glow

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 handwriting 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.

SettingDefaultWhat it does
TEXTPure glowWhat gets written.
START0.5Second the pen starts writing.
WRITE2.0Seconds the whole line takes to write.
SIZE0.20Font size as a share of the frame width.
Y0.12Where the line's center sits (0 = top, 1 = bottom).
COLOR(35, 20, 75)Ink color.
SLANT0.3Lean of the pen's leading edge, to match the font's slant.
LIFT0.1Time to cross a gap between letters, as a share of writing the same width.

Without the skill

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

Show the prompt
Add a handwriting animation to input.mp4: the words "Pure glow" in Bradley Hand Bold (or any handwriting font), font size 20% of the frame width, deep violet ink (35, 20, 75), centered across with the line's center 12% of the way down. The text writes itself on from left to right as if an unseen pen were drawing it, starting at 0.5 seconds and finishing at 2.5 seconds: reveal it with a mask whose leading edge leans to the right like the handwriting (0.3 pixels across per pixel up) and is softened over 3% of the line's width, moving at a steady pace through the letters and crossing the gap between the words in a tenth of the time. Nothing shows before 0.5 seconds, and the finished words stay to the end. Use Python with Pillow to draw the text and ffmpeg to put it on the video (don't rely on ffmpeg's drawtext filter), keep the audio, and save it as output.mp4.

Run it without Claude

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

python3 handwriting-animation.py input.mp4 output.mp4
Show the script
#!/usr/bin/env python3
"""Handwriting animation: a line of script writes itself on, left to right, as if an unseen pen were drawing it.

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

import numpy as np
from PIL import Image, ImageDraw, ImageFont

TEXT = "Pure glow"           # what gets written
START = 0.5                  # second the pen starts writing
WRITE = 2.0                  # seconds the whole line takes to write
SIZE = 0.20                  # font size as a share of the frame width
Y = 0.12                     # where the line's center sits (0 = top, 1 = bottom)
COLOR = (35, 20, 75)         # ink color, a deep violet
SLANT = 0.3                  # lean of the pen's leading edge, matching the script's slant
LIFT = 0.1                   # time to cross a gap between letters, as a share of writing the same width
EDGE = 0.03                  # soft edge where the ink is still going on, as a share of the line
FONTS = ["/System/Library/Fonts/Supplemental/Bradley Hand Bold.ttf",  # macOS
         "/usr/share/fonts/truetype/dejavu/DejaVuSerif-BoldItalic.ttf",  # Linux
         "C:/Windows/Fonts/segoesc.ttf"]                             # Windows (Segoe Script)
FONT_FILE = next((f for f in FONTS if Path(f).exists()), None) or sys.exit("No script font found: add one to FONTS")


def written_line():
    """The finished line in full, centered across the frame."""
    img = Image.new("RGBA", (w, h))
    ImageDraw.Draw(img).text((w / 2, h * Y), TEXT, font=ImageFont.truetype(FONT_FILE, round(w * SIZE)), anchor="mm", fill=COLOR)
    return img


def pen_order(line):
    """When the pen reaches each pixel, 0 at the first stroke to 1 at the last. It moves left to right with its
    leading edge leaned like the handwriting, slows where there's ink and hops across the gaps between letters."""
    ys, xs = np.mgrid[0:h, 0:w]
    u = np.round(xs + (h * Y - ys) * SLANT).astype(int)
    u -= u.min()
    ink = np.bincount(u[np.array(line.getchannel("A")) > 0], minlength=u.max() + 1)
    effort = np.where(ink > 0, 1.0, LIFT)
    effort[:np.argmax(ink > 0)] = 0  # nothing to write before the first stroke
    path = np.cumsum(effort)
    return path[u] / path[-1]


def overlay(t):
    p = min(max((t - START) / WRITE, 0), 1)
    if p == 0:
        return blank
    reveal = np.clip((p * (1 + EDGE) - order) / EDGE, 0, 1)
    frame = line_rgba.copy()
    frame[..., 3] = (frame[..., 3] * reveal).astype(np.uint8)
    return Image.fromarray(frame)


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)
line = written_line()
line_rgba = np.array(line)
order = pen_order(line)
blank = Image.new("RGBA", (w, h))
render(src, out)

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