Skip to content

Commit 50fcaa0

Browse files
authored
feat: update docs (#21)
1 parent b5d52da commit 50fcaa0

File tree

40 files changed

+3493
-598
lines changed

40 files changed

+3493
-598
lines changed

components/animata/jitter-text.tsx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
'use client'
2+
3+
import { motion } from 'motion/react'
4+
import { clsx } from '@/lib/clsx'
5+
6+
interface JitteryTextProps {
7+
text: string
8+
duration?: number
9+
className?: string
10+
}
11+
12+
export default function JitterText({ text, duration, className }: JitteryTextProps) {
13+
const animationDuration = duration ?? 0.6
14+
15+
return (
16+
<div>
17+
<motion.span
18+
className={clsx('inline-block', className)}
19+
animate={{
20+
y: [1.5, 1, -1, 1.5, -1.5, 1, -0.5, 0],
21+
x: [0, -1, 1.5, -1.5, 1, -1, 0.5, 0],
22+
rotate: [0.5, -1.5, 1, -1.5, 1, -1, 1, 0],
23+
}}
24+
transition={{
25+
repeat: Infinity,
26+
repeatDelay: 0.5,
27+
repeatType: 'reverse',
28+
ease: 'easeInOut',
29+
duration: animationDuration,
30+
}}
31+
>
32+
{text}
33+
</motion.span>
34+
</div>
35+
)
36+
}

0 commit comments

Comments
 (0)