😵 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
1npm i framer-motion
Component
Create a file skewed-text.tsx in your components folder and paste this code
1import { motion } from 'framer-motion';2import React, { useRef } from 'react';34const SkewedText = ({ children, className }: { children: React.ReactNode; className?: string }) => {5const pRef = useRef<HTMLParagraphElement | null>(null);67const onMouseMove = (e: React.MouseEvent<HTMLDivElement | HTMLButtonElement>) => {8if (!pRef.current) return;910const rect = pRef.current.getBoundingClientRect();1112const mx = e.clientX - rect.left;13const my = e.clientY - rect.top;1415const width = rect.right - rect.left;16const height = rect.bottom - rect.top;1718const xd = (mx - width / 2) / 8;19const yd = (height / 2 - my) / 8;2021pRef.current.style.transform = `perspective(1000px) rotateY(${xd + 15}deg) rotateX(${yd}deg)`;22};2324return (25<div26onMouseMove={onMouseMove}27style={{28transform: `perspective(300px) rotateX(20deg) rotateY(3deg)`29}}30className="w-full flex items-center justify-center p-10"31>32<motion.p33ref={pRef}34style={{35transform: 'perspective(300px) rotateX(10deg) rotateY(3deg)',36textShadow: '0 0 10px #00ffa39a, 0 0 30px #00ffa39a'37}}38initial={{39y: 300,40rotateX: 0,41opacity: 042}}43animate={{44y: 0,45rotateX: 20,46opacity: 1,47transition: { ease: 'backOut', duration: 1.2 }48}}49className={`font-bold transition-all duration-75 opacity-0 text-center w-[75%] italic ${className}`}50>51{children}52</motion.p>53</div>54);55};5657export default SkewedText;
Usage
1<SkewedText className="text-green-500 sm:text-lg md:text-xl">2Reality is nothing more than code. A program running endlessly, repeating itself,3glitching when something doesn’t fit. But what if you could rewrite the code?4What if you could break the loop and escape the system?5</SkewedText>
⭐️ Got a question or feedback?
Feel free to reach out!