Stackbits
Texts > Skewed Text

😵 Skewed Text

Step into the digital future with SkewedText, a bold and animated text distortion effect that makes your words look like they’re breaking free from a static world. 🔥 Inspired by cyberpunk aesthetics, sci-fi interfaces, and glitchy digital landscapes, this React component skews, shifts, and tilts text dynamically—reacting to cursor movements for an interactive, immersive feel. Perfect for hacking-inspired designs, neon-lit UIs, futuristic typography, and gaming websites, it adds movement, depth, and perspective to your UI. 🕶️💻

Preview

Reality is nothing more than code. A program running endlessly, repeating itself, glitching when something doesn’t fit. But what if you could rewrite the code? What if you could break the loop and escape the system?

Follow below steps 👇🏻

Install dependencies

1
npm i framer-motion

Component

Create a file skewed-text.tsx in your components folder and paste this code

1
import { motion } from 'framer-motion';
2
import React, { useRef } from 'react';
3
4
const SkewedText = ({ children, className }: { children: React.ReactNode; className?: string }) => {
5
const pRef = useRef<HTMLParagraphElement | null>(null);
6
7
const onMouseMove = (e: React.MouseEvent<HTMLDivElement | HTMLButtonElement>) => {
8
if (!pRef.current) return;
9
10
const rect = pRef.current.getBoundingClientRect();
11
12
const mx = e.clientX - rect.left;
13
const my = e.clientY - rect.top;
14
15
const width = rect.right - rect.left;
16
const height = rect.bottom - rect.top;
17
18
const xd = (mx - width / 2) / 8;
19
const yd = (height / 2 - my) / 8;
20
21
pRef.current.style.transform = `perspective(1000px) rotateY(${xd + 15}deg) rotateX(${yd}deg)`;
22
};
23
24
return (
25
<div
26
onMouseMove={onMouseMove}
27
style={{
28
transform: `perspective(300px) rotateX(20deg) rotateY(3deg)`
29
}}
30
className="w-full flex items-center justify-center p-10"
31
>
32
<motion.p
33
ref={pRef}
34
style={{
35
transform: 'perspective(300px) rotateX(10deg) rotateY(3deg)',
36
textShadow: '0 0 10px #00ffa39a, 0 0 30px #00ffa39a'
37
}}
38
initial={{
39
y: 300,
40
rotateX: 0,
41
opacity: 0
42
}}
43
animate={{
44
y: 0,
45
rotateX: 20,
46
opacity: 1,
47
transition: { ease: 'backOut', duration: 1.2 }
48
}}
49
className={`font-bold transition-all duration-75 opacity-0 text-center w-[75%] italic ${className}`}
50
>
51
{children}
52
</motion.p>
53
</div>
54
);
55
};
56
57
export default SkewedText;

Usage

1
<SkewedText className="text-green-500 sm:text-lg md:text-xl">
2
Reality is nothing more than code. A program running endlessly, repeating itself,
3
glitching when something doesn’t fit. But what if you could rewrite the code?
4
What if you could break the loop and escape the system?
5
</SkewedText>

⭐️ Got a question or feedback?
Feel free to reach out!