colourful-text
aceternity/colourful-textUnverifiedComponent
aceternity publishes no description for this item.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/rickhallett/becoming-diamond-nextjs/main/colourful-text.jsonSource
1"use client";2import React from "react";3import { motion } from "motion/react";45export default function ColourfulText({ text }: { text: string }) {6 const colors = [7 "rgb(131, 179, 32)",8 "rgb(47, 195, 106)",9 "rgb(42, 169, 210)",10 "rgb(4, 112, 202)",11 "rgb(107, 10, 255)",12 "rgb(183, 0, 218)",13 "rgb(218, 0, 171)",14 "rgb(230, 64, 92)",15 "rgb(232, 98, 63)",16 "rgb(249, 129, 47)",17 ];1819 const [currentColors, setCurrentColors] = React.useState(colors);20 const [count, setCount] = React.useState(0);2122 React.useEffect(() => {23 const interval = setInterval(() => {24 const shuffled = [...colors].sort(() => Math.random() - 0.5);25 setCurrentColors(shuffled);26 setCount((prev) => prev + 1);27 }, 5000);2829 return () => clearInterval(interval);30 }, []);3132 return text.split("").map((char, index) => (33 <motion.span34 key={`${char}-${count}-${index}`}35 initial={{36 y: 0,37 }}38 animate={{39 color: currentColors[index % currentColors.length],40 y: [0, -3, 0],41 scale: [1, 1.01, 1],42 filter: ["blur(0px)", `blur(5px)`, "blur(0px)"],43 opacity: [1, 0.8, 1],44 }}45 transition={{46 duration: 0.5,47 delay: index * 0.05,48 }}49 className="inline-block whitespace-pre font-sans tracking-tight"50 >51 {char}52 </motion.span>53 ));54}
Files it writes
More from aceternity
All 89 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| 3d-card3d-card | aceternity | Components | Unverified | no deps | |
| 3d Globe3d-globe | aceternity | Components | Free | 3 deps | |
| 3d-marquee3d-marquee | aceternity | Components | Unverified | no deps | |
| 3d-pin3d-pin | aceternity | Components | Unverified | 1 dep | |
| animated-modalanimated-modal | aceternity | Components | Unverified | 1 dep | |
| animated-testimonialsanimated-testimonials | aceternity | Components | Unverified | 2 deps | |
| animated-tooltipanimated-tooltip | aceternity | Components | Unverified | 1 dep | |
| apple-cards-carouselapple-cards-carousel | aceternity | Components | Unverified | 2 deps |
