scrambleText
scrambleText is a 1kb function that provides scramble text animations for vanilla JavaScript. It works with DOM elements or MotionValues.
scrambleText is exclusive to Motion+ members. Motion+ is a one-time payment, lifetime membership that unlocks exclusive components, premium examples and access to a private Discord community.
Features
Stagger: Use Motion's
staggerfunction for bothdelayanddurationto create letter-by-letter reveal effects.Playback control: Returns playback controls to pause, play, hard stop or finish your animations.
Customisable characters: Use the default alphanumeric set, or provide custom characters (including emoji).
Install
First, add the motion-plus package to your project using your private token. You need to be a Motion+ member to generate a private token.
Usage
Pass an element or CSS selector to scramble its text content:
With MotionValue
Alternatively, you can pass a MotionValue<string> to scrambleText. It will animate back to the value as read when the animation starts.
Stagger
Use Motion's stagger() function to reveal characters one by one:
Delay stagger
Stagger when each character starts scrambling:
Direction
Use stagger's from option to control reveal direction:
Infinite scramble
Set duration to Infinity for continuous scrambling until stopped:
Custom characters
Character presets:


