Command Palette

Search for a command to run...

Docs
Text Trail

Text Trail

WebGL-based text trail effect with mouse-following fluid distortion powered by Three.js

Installation

Usage

import TextTrail from "@/components/motionx/text-trail";

Basic usage

<div className="w-full h-[400px]">
  <TextTrail text="Hello World" />
</div>

Custom colors

<div className="w-full h-[400px]">
  <TextTrail
    text="MotionX UI"
    textColor="#ffffff"
    backgroundColor={0x0a0a0a}
    fontWeight="900"
  />
</div>

Animated color cycling

<div className="w-full h-[400px]">
  <TextTrail
    text="Rainbow"
    animateColor={true}
    textColor=""
    colorCycleInterval={2000}
  />
</div>

Props

PropTypeDefaultDescription
textstring"Trail"Text content to display
fontFamilystring"Figtree"Font family for the text
fontWeightstring | number"900"Font weight value
noiseFactornumber1Simplex noise frequency multiplier
noiseScalenumber0.0005Scale of noise displacement
rgbPersistFactornumber0.98RGB fade persistence (0-1, higher = longer trails)
alphaPersistFactornumber0.95Alpha fade persistence (0-1, higher = longer trails)
animateColorbooleanfalseEnable automatic color cycling
startColorstring"#ffffff"Initial color when animateColor is enabled
textColorstring"#ffffff"Fixed text color (set to "" for color cycling)
backgroundColornumber | string0x271e37WebGL clear color (hex number or string)
colorCycleIntervalnumber3000Color change interval in ms (when animateColor)
supersamplenumber2Text rendering supersample factor for clarity

Note: The component requires a parent container with explicit width and height. It fills 100% of its parent using w-full h-full.