MotionFlow logo

Text Effects

MotionFlow Text animates inline text content, enabling smooth looping transitions and realistic typing effects. All text animations share a common configuration model, while each animation type provides its own specialized attributes and behavior.

# Getting started

MotionFlow Text animates inline text content using two built-in modes: Loop (rotating text items) and Typing (character-by-character typing effect).

Text animations start automatically as soon as the page loads. They do not depend on scroll position or viewport triggers.

No initialization required. No configuration required. Simply add the appropriate data-mf-text-* attributes and MotionFlow handles everything automatically.

Demo
Loop Mode
Build fastsmoothlightweight websites
Typing Mode
MotionFlowText Animations
<!-- Loop mode -->
<span data-mf-text-type="loop">
  <span>fast</span>
  <span>smooth</span>
  <span>lightweight</span>
</span>

<!-- Typing mode -->
<span data-mf-text-type="typing">
  <span>MotionFlow</span>
  <span>Text Animations</span>
</span>

Both modes treat each direct child element as an individual text item and animate them sequentially using their respective behaviors.

# Loop mode

Loop mode cycles through multiple text items one by one using the animation engine.

Each direct child element inside the container is treated as an individual loop item and animated sequentially in an infinite loop, without requiring any user interaction.

Loop mode is best suited for rotating keywords or short phrases where continuous motion is desired without relying on scroll position.

Demo

Build fastsmoothlightweight websites

<div 
 data-mf-text-type="loop"
 data-mf-text-loop-animation="fade-up" 
 data-mf-text-loop-interval="2000"
 data-mf-text-loop-duration="500" 
 data-mf-text-loop-distance="20"
 data-mf-text-loop-easing="ease"
>
  <span>fast</span>
  <span>smooth</span>
  <span>lightweight</span>
</div>

You don’t need to add every attribute. MotionFlow has default values for all attributes. Default values are listed in the table below. Add an attribute only when you want to override the default.

AttributeDefaultDescription
data-mf-text-typeSet to loop to enable loop mode
data-mf-text-loop-animationfade-upMotionFlow animation applied to each text item
data-mf-text-loop-interval2000Delay (in milliseconds) before switching to the next item
data-mf-text-loop-duration500Duration (in milliseconds) of each loop animation
data-mf-text-loop-easingeaseEasing function used for loop animations
data-mf-text-loop-distance40Translate distance in pixels

## Animation types

Loop mode supports multiple animation styles listed below. The selected animation is applied to each text item as it becomes active in the loop.

AnimationUsageDescription
fadedata-mf-text-loop-animation="fade"Simple fade in with no movement
fade-updata-mf-text-loop-animation="fade-up"Fades in while moving upward
fade-downdata-mf-text-loop-animation="fade-down"Fades in while moving downward
fade-leftdata-mf-text-loop-animation="fade-left"Fades in while moving from left
fade-rightdata-mf-text-loop-animation="fade-right"Fades in while moving from right
fade-up-leftdata-mf-text-loop-animation="fade-up-left"Fades in from bottom-left
fade-up-rightdata-mf-text-loop-animation="fade-up-right"Fades in from bottom-right
fade-down-leftdata-mf-text-loop-animation="fade-down-left"Fades in from top-left
fade-down-rightdata-mf-text-loop-animation="fade-down-right"Fades in from top-right
slide-updata-mf-text-loop-animation="slide-up"Slides upward into view
slide-downdata-mf-text-loop-animation="slide-down"Slides downward into view
slide-leftdata-mf-text-loop-animation="slide-left"Slides in from left
slide-rightdata-mf-text-loop-animation="slide-right"Slides in from right
zoom-indata-mf-text-loop-animation="zoom-in"Scales up while fading in
zoom-outdata-mf-text-loop-animation="zoom-out"Scales down while fading in
zoom-in-updata-mf-text-loop-animation="zoom-in-up"Zooms in from bottom
zoom-in-downdata-mf-text-loop-animation="zoom-in-down"Zooms in from top
zoom-in-leftdata-mf-text-loop-animation="zoom-in-left"Zooms in from left
zoom-in-rightdata-mf-text-loop-animation="zoom-in-right"Zooms in from right
zoom-out-updata-mf-text-loop-animation="zoom-out-up"Zooms out upward
zoom-out-downdata-mf-text-loop-animation="zoom-out-down"Zooms out downward
zoom-out-leftdata-mf-text-loop-animation="zoom-out-left"Zooms out to left
zoom-out-rightdata-mf-text-loop-animation="zoom-out-right"Zooms out to right
flip-updata-mf-text-loop-animation="flip-up"Flips upward along X-axis
flip-downdata-mf-text-loop-animation="flip-down"Flips downward along X-axis
flip-leftdata-mf-text-loop-animation="flip-left"Flips from left along Y-axis
flip-rightdata-mf-text-loop-animation="flip-right"Flips from right along Y-axis
rotatedata-mf-text-loop-animation="rotate"Rotates into place
rotate-up-leftdata-mf-text-loop-animation="rotate-up-left"Rotates upward from left
rotate-up-rightdata-mf-text-loop-animation="rotate-up-right"Rotates upward from right
rotate-down-leftdata-mf-text-loop-animation="rotate-down-left"Rotates downward from left
rotate-down-rightdata-mf-text-loop-animation="rotate-down-right"Rotates downward from right
blurdata-mf-text-loop-animation="blur"Fades in while removing blur
blur-updata-mf-text-loop-animation="blur-up"Blurs + fades in while moving upward
blur-downdata-mf-text-loop-animation="blur-down"Blurs + fades in while moving downward
blur-leftdata-mf-text-loop-animation="blur-left"Blurs + fades in while moving from left
blur-rightdata-mf-text-loop-animation="blur-right"Blurs + fades in while moving from right
hingedata-mf-text-loop-animation="hinge"Hinged rotation from the top (center origin)
hinge-leftdata-mf-text-loop-animation="hinge-left"Hinged rotation from top-left corner
hinge-rightdata-mf-text-loop-animation="hinge-right"Hinged rotation from top-right corner
lightspeed-leftdata-mf-text-loop-animation="lightspeed-left"Fast skewed slide-in from left
lightspeed-rightdata-mf-text-loop-animation="lightspeed-right"Fast skewed slide-in from right
roll-leftdata-mf-text-loop-animation="roll-left"Rolls in from left while rotating
roll-rightdata-mf-text-loop-animation="roll-right"Rolls in from right while rotating
back-in-updata-mf-text-loop-animation="back-in-up"Enters from below, pauses briefly, then scales to full size
back-in-downdata-mf-text-loop-animation="back-in-down"Enters from above, pauses briefly, then scales to full size
back-in-leftdata-mf-text-loop-animation="back-in-left"Enters from the left, pauses briefly, then scales to full size
back-in-rightdata-mf-text-loop-animation="back-in-right"Enters from the right, pauses briefly, then scales to full size
bouncedata-mf-text-loop-animation="bounce"Bounces into place with subtle vertical movement
bounce-updata-mf-text-loop-animation="bounce-up"Bounces upward from below the viewport
bounce-downdata-mf-text-loop-animation="bounce-down"Bounces downward from above the viewport
bounce-leftdata-mf-text-loop-animation="bounce-left"Bounces in from the left side
bounce-rightdata-mf-text-loop-animation="bounce-right"Bounces in from the right side
bounce-scaledata-mf-text-loop-animation="bounce-scale"Bounces using scale only (no directional movement)
bounce-rotatedata-mf-text-loop-animation="bounce-rotate"Bounces into place with rotation and scaling

## Easing

Control the feel of loop transitions using easing presets. The available options are listed below.

Easing presetUsage
lineardata-mf-text-loop-easing="linear"
easedata-mf-text-loop-easing="ease"
ease-indata-mf-text-loop-easing="ease-in"
ease-outdata-mf-text-loop-easing="ease-out"
ease-in-outdata-mf-text-loop-easing="ease-in-out"
ease-in-backdata-mf-text-loop-easing="ease-in-back"
ease-out-backdata-mf-text-loop-easing="ease-out-back"
ease-in-out-backdata-mf-text-loop-easing="ease-in-out-back"
ease-in-sinedata-mf-text-loop-easing="ease-in-sine"
ease-out-sinedata-mf-text-loop-easing="ease-out-sine"
ease-in-out-sinedata-mf-text-loop-easing="ease-in-out-sine"
ease-in-quaddata-mf-text-loop-easing="ease-in-quad"
ease-out-quaddata-mf-text-loop-easing="ease-out-quad"
ease-in-out-quaddata-mf-text-loop-easing="ease-in-out-quad"
ease-in-cubicdata-mf-text-loop-easing="ease-in-cubic"
ease-out-cubicdata-mf-text-loop-easing="ease-out-cubic"
ease-in-out-cubicdata-mf-text-loop-easing="ease-in-out-cubic"
ease-in-quartdata-mf-text-loop-easing="ease-in-quart"
ease-out-quartdata-mf-text-loop-easing="ease-out-quart"
ease-in-out-quartdata-mf-text-loop-easing="ease-in-out-quart"
ease-in-quintdata-mf-text-loop-easing="ease-in-quint"
ease-out-quintdata-mf-text-loop-easing="ease-out-quint"
ease-in-out-quintdata-mf-text-loop-easing="ease-in-out-quint"
ease-in-expodata-mf-text-loop-easing="ease-in-expo"
ease-out-expodata-mf-text-loop-easing="ease-out-expo"
ease-in-out-expodata-mf-text-loop-easing="ease-in-out-expo"
ease-in-circdata-mf-text-loop-easing="ease-in-circ"
ease-out-circdata-mf-text-loop-easing="ease-out-circ"
ease-in-out-circdata-mf-text-loop-easing="ease-in-out-circ"
ease-in-elasticdata-mf-text-loop-easing="ease-in-elastic"
ease-out-elasticdata-mf-text-loop-easing="ease-out-elastic"
ease-in-out-elasticdata-mf-text-loop-easing="ease-in-out-elastic"
ease-in-bouncedata-mf-text-loop-easing="ease-in-bounce"
ease-out-bouncedata-mf-text-loop-easing="ease-out-bounce"
ease-in-out-bouncedata-mf-text-loop-easing="ease-in-out-bounce"

# Typing mode

Typing mode simulates a realistic typing and deleting effect by revealing text character by character.

Each direct child element inside the container is treated as a separate phrase that is typed, erased, and optionally repeated in sequence.

Typing mode works well for dynamic headings, introductions, and short messages where character-level animation adds emphasis and personality.

Demo

MotionFlowText AnimationsMade Simple

<div 
 data-mf-text-type="typing" 
 data-mf-text-typing-speed="80"
 data-mf-text-typing-delete-speed="40"
 data-mf-text-typing-interval="1200" 
 data-mf-text-typing-loop="true"
 data-mf-text-typing-cursor="true"
 data-mf-text-typing-cursor-char="|" 
 data-mf-text-typing-cursor-blink="true"
>
  <span>MotionFlow</span>
  <span>Text Animations</span>
  <span>Made Simple</span>
</div>

You don’t need to add every attribute. MotionFlow has default values for all attributes. Default values are listed in the table below. Add an attribute only when you want to override the default.

AttributeDefaultDescription
data-mf-text-typeSet to typing to enable typing mode
data-mf-text-typing-speed80Typing speed in milliseconds per character
data-mf-text-typing-delete-speed40Deleting speed in milliseconds per character
data-mf-text-typing-interval1200Pause (in milliseconds) after typing completes, before deleting begins
data-mf-text-typing-looptrueControls whether the typing sequence repeats
data-mf-text-typing-cursortrueShow or hide the typing cursor
data-mf-text-typing-cursor-char|Character used as the typing cursor
data-mf-text-typing-cursor-blinktrueEnable or disable cursor blinking

When looping is disabled, typing stops after the final phrase is fully typed and the cursor is hidden automatically.

# Text effects lifecycle

Text effects (loop and typing) initialize automatically when the page loads. In most cases, no manual control is required.

If text elements are added dynamically, shown later (for example inside accordions, tabs, or modals), or their content changes, you can control the text effects lifecycle using the methods below.

MethodMethod callDescription
initMotionFlow.text.init();Initializes or re-initializes text effects using the last configuration
refreshMotionFlow.text.refresh();Rebuilds text effects and retries initialization for newly added or updated text elements
destroyMotionFlow.text.destroy();Stops and removes all active text effects and restores the original content

## Example usage

When text elements become visible dynamically or are injected into the DOM, refresh the text engine to ensure effects are initialized correctly.

// Call this after text elements are added or shown
function onTextLayoutChange() {
MotionFlow.text.refresh();
}

# Global configuration (optional)

Text effects work automatically using HTML attributes. You only need global configuration if you want to change default behavior or reuse the same settings across multiple elements.

Individual elements can still override these values using data-mf-text-* attributes.

MotionFlow.init({
  text: {
    /* --------------------------------
       Loop text
     --------------------------------- */
    loop: {
      animation: "fade-up", // Default : fade-up  | fade-up | slide-up | slide-down | zoom | etc
      interval: 2000,       // Default : 2000     | Time between text changes (ms)
      duration: 500,        // Default : 500      | Animation duration (ms)
      easing: "ease",       // Default : ease     | Any MotionFlow easing preset
      distance: 40          // Default : 40       | Translate distance in pixels
    },
    /*  --------------------------------
       Typing text
     ----------------------------------- */
    typing: {
      speed: 80,            // Default : 80       | Typing speed (ms per character)
      deleteSpeed: 40,      // Default : 40       | Deleting speed (ms per character)
      interval: 1200,       // Default : 1200     | Pause before deleting (ms)
      loop: true,           // Default : true     | Loop typing animation
      cursor: true,         // Default : true     | Show typing cursor
      cursorChar: "|",      // Default : "|"      | Cursor character
      cursorBlink: true     // Default : true     | Blinking cursor animation
    }
  }
});

If you don’t provide any text configuration, MotionFlow uses sensible built-in defaults automatically.