import React, { useEffect, useState } from 'react'; import { motion } from 'framer-motion'; const LEAF_TYPES = [ // Type 1: Maple Leafish (color) => ( ), // Type 2: Oak Leafish (color) => ( ), // Type 3: Simple Ellipse Leaf (color) => ( ), ]; const COLORS = ['#eab308', '#f97316', '#ef4444', '#a16207', '#d97706']; // Yellows, Oranges, Reds, Browns const DigitalLeaves = () => { const [leaves, setLeaves] = useState([]); useEffect(() => { // Generate random leaves const newLeaves = Array.from({ length: 50 }).map((_, i) => ({ id: i, left: Math.random() * 100, // percentage size: 30 + Math.random() * 40, // px delay: Math.random() * 5, // seconds duration: 10 + Math.random() * 10, // seconds to fall type: Math.floor(Math.random() * LEAF_TYPES.length), color: COLORS[Math.floor(Math.random() * COLORS.length)], rotation: Math.random() * 360, })); setLeaves(newLeaves); }, []); return (
{leaves.map((leaf) => ( {LEAF_TYPES[leaf.type](leaf.color)} ))}
); }; export default DigitalLeaves;