Skip to the content

Text scramble

Text shuffles through glyphs and settles back into its own words, character by character.

Create a free account to unlock it.

Sign up free

Already a member? Sign in

Version

Documentation

  1. Copy to Webflow

    Add Geist and Geist Mono to your site's fonts (Site settings, Fonts, Google Fonts) before pasting: Webflow removes any font your site has not installed.

  2. Add custom CSS

  3. Add custom JS

  4. Use it on your own elements

    Custom attributes
    Select the element on the canvas and open the Settings panel. Under Custom attributes, add a pair: the name on the left, the value on the right.
    Custom attributeWhat it does
    data-text-scramble="scroll" the text settles as it comes into view
    data-text-scramble="hover" it plays when the pointer enters it, when it takes keyboard focus, and once per tap
    data-text-scramble="scroll hover" both: it settles on scroll, then plays again on every hover
    An empty or unknown value falls back to scroll, and says so in the browser console with the element and the three accepted values. The trigger is written here and nowhere else: no setting and no page-wide block can turn a hover into a scroll.
    Settings
    Every setting is a custom attribute too, added the same way and on the same element. An attribute always wins over the defaults written in the code.
    AttributeDefaultWhat it is
    data-text-scramble-color auto Colour of the glyphs while they are scrambled. Options: any CSS colour, or auto to keep the text's own colour.
    data-text-scramble-chars symbols digits The glyphs the text shuffles through. Options: symbols, digits, letters, any of them combined with spaces (symbols digits), or any other string, taken as the glyphs themselves (01, /|_).
    data-text-scramble-duration 0.5 How long one character stays scrambled before it settles, in seconds.
    data-text-scramble-stagger 0.03 Delay between two characters starting, in seconds.
    data-text-scramble-spread 1.2 The longest the wave may take from the first character to the last, in seconds; a long text shrinks its stagger to fit.
    data-text-scramble-speed 30 How many times per second a scrambled glyph changes, 1 to 120.
    data-text-scramble-order start Which characters settle first. Options: start (reading order), end, center (from the middle out), edges (from both ends in), random.
    data-text-scramble-delay 0 Wait before the effect starts, in seconds.
    data-text-scramble-trigger 0.86 How far into the screen the text has to come before it plays on scroll, as a share of the viewport height.
    data-text-scramble-replay false Whether a scroll effect plays again every time the text comes back into view. Options: false (once), true (every entry).

What it does

Text scramble is a text animation for Webflow and vanilla JavaScript, with no library. Also called text scramble on scroll and hover or scramble text.

Text shuffles through glyphs and settles back into its own words, character by character. Symbols, digits, letters, any mix of them, or a string of your own. It plays as the text comes into view on scroll, or when the pointer enters it, and the choice is written on the element itself, as the value of its attribute: data-text-scramble="scroll", "hover", or "scroll hover". The words never move: the native text stays exactly where it is, its scrambled characters are emptied one range at a time, and the glyphs are drawn over them in a layer of no size, each one picked among glyphs about as wide as the letter it covers. So nothing reflows, in a proportional face as in a mono, on one line or ten, at any width; links, bold, italics and coloured spans come back untouched; and a screen reader reads the real text the whole time. Pattern type text scramble, decode effect, terminal flavour.

Updated

Questions

Paste the component, then give your text element the custom attribute data-text-scramble with the value scroll, hover or scroll hover in the Settings panel. The trigger is that value and nothing else: no class, no page setting and no code. An empty or unknown value falls back to scroll and logs a console warning.

Yes. This text scramble uses no library and no build step. It empties the native characters with the CSS Custom Highlight API and draws the glyphs over them in an absolutely positioned layer.

data-text-scramble-chars takes symbols, digits, letters, a mix such as symbols digits (the default), or any string of your own such as 01. data-text-scramble-duration is how long one character stays scrambled, 0.5 seconds by default, and data-text-scramble-speed is how many times per second a glyph changes, 30 by default, from 1 to 120.

No. The native text stays where it is and each glyph is drawn over it in a layer of no size, picked among glyphs about as wide as the letter it covers, so no line can wrap differently. Gradient text painted with background-clip: text or -webkit-text-fill-color is the exception: it fights the mechanism.

Yes. Hover listens to pointerenter and focusin, so a mouse, a pen, a finger (one play per tap) and keyboard focus all start it. A screen reader reads the real text the whole time, and under prefers-reduced-motion: reduce nothing is scrambled and nothing is hidden.