Skip to content

Commit fb708f3

Browse files
feat: Animate hero section text
Implement a dust animation effect on the hero section text and apply the revon font style.
1 parent 4f52b66 commit fb708f3

File tree

1 file changed

+46
-4
lines changed

1 file changed

+46
-4
lines changed

src/components/home/HeroSection.tsx

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,49 @@
11

22
import { Button } from "@/components/ui/button";
33
import { Link } from "react-router-dom";
4-
import { ArrowRight, Heart, Shield, Search } from "lucide-react";
4+
import { ArrowRight, Heart, Shield, Search, Sparkles } from "lucide-react";
5+
6+
// Function to animate each character in "AI Precision" with a sparkle
7+
const AnimatedAIText = () => {
8+
const text = "AI Precision";
9+
// We'll animate each letter after the last, slight stagger
10+
return (
11+
<span
12+
className="bg-clip-text text-transparent bg-gradient-to-r from-revon-primary to-revon-accent inline-block font-playfair"
13+
aria-label={text}
14+
>
15+
{[...text].map((char, idx) => (
16+
<span
17+
className={`relative inline-block animate-fade-in !opacity-0`}
18+
style={{
19+
animationDelay: `${0.15 + idx * 0.08}s`,
20+
animationFillMode: "forwards",
21+
}}
22+
key={idx}
23+
>
24+
{char === " " ? "\u00A0" : char}
25+
{/* Sparkle dust appears above letters, skip for spaces */}
26+
{char !== " " && (
27+
<span
28+
className="absolute -top-3 left-1/2 -translate-x-1/2 pointer-events-none"
29+
style={{ animation: `dust-pop 0.7s ${0.13 + idx * 0.08}s both` }}
30+
>
31+
<Sparkles className="w-4 h-4 text-revon-accent opacity-80" />
32+
</span>
33+
)}
34+
</span>
35+
))}
36+
<style>{`
37+
@keyframes dust-pop {
38+
0% { opacity: 0; transform: scale(0.4) translateY(6px);}
39+
50% { opacity: .9; transform: scale(1.2) translateY(-6px);}
40+
80% { opacity: .6; transform: scale(0.93) translateY(-2px);}
41+
100% { opacity: 0; transform: scale(.7) translateY(0);}
42+
}
43+
`}</style>
44+
</span>
45+
);
46+
};
547

648
const HeroSection = () => {
749
return (
@@ -14,8 +56,8 @@ const HeroSection = () => {
1456
</div>
1557

1658
<h1 className="text-4xl md:text-5xl font-bold tracking-tight leading-tight">
17-
Understand Your Symptoms with
18-
<span className="bg-clip-text text-transparent bg-gradient-to-r from-revon-primary to-revon-accent inline-block transition-transform duration-500 hover:scale-105 hover:translate-x-1"> AI Precision</span>
59+
Understand Your Symptoms with{" "}
60+
<AnimatedAIText />
1961
</h1>
2062

2163
<p className="text-lg text-muted-foreground max-w-md">
@@ -55,7 +97,7 @@ const HeroSection = () => {
5597
<div className="relative">
5698
<div className="absolute -z-10 inset-0 bg-gradient-radial from-revon-primary/20 to-transparent opacity-70" />
5799

58-
<div className="bg-white dark:bg-card rounded-2xl shadow-xl p-8 max-w-md mx-auto">
100+
<div className="bg-white dark:bg-card rounded-2xl shadow-xl p-8 max-w-md mx-auto transition-all duration-300 hover:scale-105 hover:shadow-2xl hover:bg-revon-primary/5">
59101
<div className="space-y-6">
60102
<div className="flex items-center justify-between">
61103
<h3 className="text-lg font-medium">Symptom Checker</h3>

0 commit comments

Comments
 (0)