File size: 1,170 Bytes
09fa60b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"use client";

import { useEffect, useState } from "react";
import { Music2 } from "lucide-react";

interface Note {
  id: number;
  x: number;
  delay: number;
  duration: number;
}

export function FloatingNotes() {
  const [notes, setNotes] = useState<Note[]>([]);

  useEffect(() => {
    const generateNotes = () => {
      const newNotes: Note[] = [];
      for (let i = 0; i < 5; i++) {
        newNotes.push({
          id: i,
          x: Math.random() * 100,
          delay: Math.random() * 5,
          duration: 8 + Math.random() * 4,
        });
      }
      setNotes(newNotes);
    };

    generateNotes();
  }, []);

  return (
    <div className="fixed inset-0 pointer-events-none overflow-hidden opacity-20">

      {notes.map((note) => (

        <div

          key={note.id}

          className="absolute bottom-0 animate-float-up"

          style={{

            left: `${note.x}%`,

            animationDelay: `${note.delay}s`,

            animationDuration: `${note.duration}s`,

          }}

        >

          <Music2 className="h-6 w-6 text-primary" />

        </div>

      ))}

    </div>
  );
}