For each character position in the target string, decide which frame it should "lock in" on (left to right in order, or randomized), and until that frame, draw a different random glyph (uppercase letters, digits, symbols) from a character pool every frame. Once locked, that position freezes on its final character.
Pick a total frame count (typically 20–30 animation frames) and compare each character's index against overall progress so positions lock left-to-right in order — that reads like a typewriter decoding left to right.
If the starting and target strings differ in length (e.g. "HOVER ME" → "DECODED"), loop to the longer length and let the shorter string's extra slots fill with random glyphs before fading out, so the transition still feels natural.
When to use
Use it sparingly — a hero headline on a code/terminal-themed page, a button label changing state. Don't use it in body copy.