Updated
Rust Text
Rust never sleeps
Customize
Duration14s
Start0.15
Brush30px
Text size96px
Installation
npx shadcn@latest add https://uibrik.com/r/rust-text.jsonInstall the packages
npm install motionAdd the cn helper
Imports
cnfrom@/lib/utils, whichshadcn initcreates. Add it by hand without shadcn.Copy the source into your project
components/uibrik/rust-text/rust-text.tsx"use client"; import { useEffect, useRef } from "react"; import { useReducedMotion } from "motion/react"; import { cn } from "@/lib/utils"; // Size comes from --text-effect-size (default 1.25rem, i.e. text-xl), so a // preview can enlarge every effect without changing the installed default. const SIZE = "text-[length:var(--text-effect-size,1.25rem)] leading-[1.4]"; // Rust text. Brushed steel type that oxidises while you watch: orange blooms // open from the edges of each stroke and spread across it, darken as they // age, and finally flake off in small pieces that fall away. Moving the // pointer over it polishes the metal back, with a brief shine where it // passed, and the rust starts again from there. // // Every pixel inside the glyphs has its own age. A noise field decides when // each one starts to turn, biased so thin edges go first, so the rust grows // as patches rather than a fade. Polishing just takes age away. const FALL = 1.4; // room under the text for falling flakes, in em const ONSET_SCALE = 38; // px per rust patch const TINT_SCALE = 12; const FLAKE_SCALE = 5;
Adds the files to
components/uibrik/rust-text and installs motion. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/rust-text.Usage
import { RustText } from "@/components/uibrik/rust-text/rust-text";<RustText text="Rust never sleeps" duration={14} start={0.15} brush={30} flakes/>Where to use Rust Text
Industrial brands
Brushed steel type that rusts and flakes suits hardware and manufacturing products.
Interactive titles
Polishing the type back to shine under the pointer rewards visitors who play.
Creative portfolios
A material-based text effect shows craft in WebGL.
Props
RustText- text
- Type string
- "Rust never sleeps"
- The words, on one line.
- duration
- Type number
- 14
- Time for clean metal to rust right through.
- start
- Type number
- 0.15
- How rusted it is when it appears.
- brush
- Type number
- 30
- Polishing brush radius.
- flakes
- Type boolean
- true
- Let fully rusted metal flake off.
- className
- Type string
- –
- Classes for the wrapper.