Luca Perullo
Components

Component

LiveNew

Shiny Text

Una sola riga di CSS animata con background-clip: text. Loop infinito di un gradiente diagonale che attraversa il testo. Lightweight, niente JS.

TextAnimationCTAClient
Open in ClaudeSorgente

Esempio01

shiny-text.tsx
Start free →Premium signal sweep

Note background-clip: text richiede color: transparent + WebkitTextFillColor: transparent. Speed bassa (2-3s) = aggressivo, alta (5-6s) = soft. prefers-reduced-motion blocca l'animazione.

Prompt LLM02

Incolla in Claude o ChatGPT per generare la tua variante. Include il contesto del brand, i token e i vincoli del progetto.

Prompt · shiny-text
Open in Claude
Sei un senior frontend engineer. Stai lavorando su un sito Next.js 16 + React 19 + Tailwind v4 in italiano, look chanhdai-inspired: colonna stretta 672px, Geist Sans + Geist Mono, hairline 1px, divisori a stripe diagonale, palette zinc.

Token CSS disponibili: --bg, --bg-alt, --fg, --fg-muted, --fg-soft, --border, --border-strong, --accent. Usa SEMPRE queste variabili tramite le utility tailwind generate (bg-bg, text-fg-muted, border-border, ecc.). Helper "cn" da "@/lib/utils". Niente librerie UI extra: solo lucide-react e tailwind-merge.

Genera un componente <ShinyText> con riflesso metallico in loop.
Props:
- children: ReactNode.
- speed?: number sec (default 3).
- baseColor?: string (default "var(--fg-muted)").
- shineColor?: string (default "var(--fg)").
- className?: string.

Implementazione:
- "use client".
- Inline <style> con keyframes shiny-sweep: background-position from 200% center → -200% center.
- Inline style sul <span>: backgroundImage linear-gradient(110deg, base, base 40%, shine 50%, base 60%, base), backgroundSize 200% auto, backgroundClip text + WebkitBackgroundClip text, color transparent + WebkitTextFillColor transparent, animation shiny-sweep speed linear infinite.
- Media (prefers-reduced-motion: reduce) blocca animation.

Output: file completo src/components/shiny-text.tsx.

Uso tipico03

tsx
<ShinyText speed={3} baseColor="var(--fg-muted)" shineColor="var(--fg)">Start free →</ShinyText>

Dipendenze04

npm
  • tailwind-merge
  • clsx
Interno
  • @/lib/utils#cn

Ti è servito? Dimmelo, oppure proponi il prossimo componente.