GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • DocsDocs
  • ExamplesExamples
  • AI KitAIAI KitAI
  • React
  • JS
  • Vue
  • AI
  • animate
  • Timeline sequences
  • animateLayout
  • animateView
  • scroll
  • Easing
  • drag

This view

  • Original page
  • New address

GeezerVison is showing motion.dev — scrambleText - Create scrambled text animations | Motion

MOTION+

This feature is available with Motion+.

scrambleText is a 1kb function that provides scramble text animations for vanilla JavaScript. It works with DOM elements or MotionValues.

import { scrambleText } from "motion-plus"

scrambleText("#title", { duration: 1 })
Scramble textOpen example

scrambleText is exclusive to Motion+ members. Motion+ is a one-time payment, lifetime membership that unlocks Motion UI, premium examples and access to a private Discord community.

Features

  • Stagger: Use Motion's stagger function for both delay and duration to 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).

Black Friday

Motion+ is 20% off until 30 Nov.

One payment, lifetime updates. Get every premium example, Motion UI and AI Kit for your coding agent.

Get 20% offGet 20% off

Install

First, install Motion UI in your project. You need to be a Motion+ member to generate an access token.

Usage

Pass an element or CSS selector to scramble its text content:

import { scrambleText } from "motion-plus-dom"

// With selector
scrambleText("#title", { duration: 1 })

// With element reference
const element = document.querySelector(".text")
scrambleText(element, { duration: 1 })

With MotionValue

Alternatively, you can pass a MotionValue<string> to scrambleText. It will animate back to the value as read when the animation starts.

import { scrambleText } from "motion-plus-dom"
import { motionValue } from "motion"

const text = motionValue("Hello world!")

// Subscribe to changes
text.on("change", (latest) => {
  document.querySelector("#title").textContent = latest
})

scrambleText(text, { duration: 1 })

Stagger

Use Motion's stagger() function to reveal characters one by one:

import { scrambleText } from "motion-plus-dom"
import { stagger } from "motion"

// Start scrambling at the same time, reveal with stagger
scrambleText(element, {
  duration: stagger(0.05, { startDelay: 1 })
})
Scramble text: Stagger from centerOpen example

Delay stagger

Stagger when each character starts scrambling:

// Chars start scrambling one-by-one, all reveal after 1s
scrambleText(element, {
  delay: stagger(0.1),
  duration: 1
})

Direction

Use stagger's from option to control reveal direction:

scrambleText(element, {
  delay: stagger(0.05, { from: "center" }),
  duration: 0.5
})
Motion+ docsOne payment
Lifetime updates
Motion+ docs

Unlock scrambleText with Motion+

Motion+ is a lifetime purchase unlocking 550+ examples, Motion UI, AI Kit and more.

Examples
550+
Tutorials
110+
Updates
Lifetime
Get Motion+Get Motion+Already a member? Sign in
  1. 01splitText

    splitText() breaks text into characters, words, and lines for granular text animations.

  2. 02animate

    animate() runs easing and spring animations, hardware-accelerated where supported.

  3. 03stagger

    stagger() distributes a delay across elements, with control over origin, grids and easing.

  • Scramble text animation exampleScramble text
  • Scramble text: Stagger from center animation exampleScramble text: Stagger from center

Motion is supported by

Motion Cloud members who help fund Motion’s open-source development.

Become a supporter
  • SStanislav Shilin
  • AAriel Rodribuez
  • nimit
  • Sean Bugeja
  • Meepo
  • CCNTNAI
  • DDamián Navarro
  • AAriel Conti
  • electrinity
  • Joshosullivam
  • BBeto
  • AAbhishek
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.