From dfe95648b0943622e2b7497609e47d7b8fee74c6 Mon Sep 17 00:00:00 2001 From: PrimeBuild Date: Mon, 13 Jul 2026 03:39:33 +0200 Subject: [PATCH 1/2] feat: rotate random animated hero backgrounds --- client/src/components/HeroSection.tsx | 158 ++++++++++++++++++-------- client/src/index.css | 52 +++++++++ 2 files changed, 161 insertions(+), 49 deletions(-) diff --git a/client/src/components/HeroSection.tsx b/client/src/components/HeroSection.tsx index a9a08a9..e0ce1c4 100644 --- a/client/src/components/HeroSection.tsx +++ b/client/src/components/HeroSection.tsx @@ -1,10 +1,84 @@ -import { useEffect, useRef, useState } from "react"; -import { ArrowDown, ArrowUpRight, Check } from "lucide-react"; +import { CSSProperties, useEffect, useRef, useState } from "react"; +import { ArrowDown, ArrowUpRight, Check, Cog } from "lucide-react"; import { trackCTAClick } from "@/lib/analytics"; +const backgrounds = ["geometry", "matrix", "gears"] as const; +type Background = (typeof backgrounds)[number]; + +const pickBackground = (): Background => { + const requested = new URLSearchParams(location.search).get("background"); + if (backgrounds.includes(requested as Background)) return requested as Background; + + try { + const previous = sessionStorage.getItem("primebuild-background"); + const choices = backgrounds.filter((item) => item !== previous); + const selected = choices[Math.floor(Math.random() * choices.length)]; + sessionStorage.setItem("primebuild-background", selected); + return selected; + } catch { + return backgrounds[Math.floor(Math.random() * backgrounds.length)]; + } +}; + +const HeroBackground = ({ variant }: { variant: Background }) => { + if (variant === "matrix") { + return ( + + ); + } + + if (variant === "gears") { + const gears = [ + ["8%", "12%", "16rem", "gear-clockwise"], + ["25%", "54%", "10rem", "gear-counter"], + ["58%", "8%", "22rem", "gear-counter"], + ["70%", "58%", "14rem", "gear-clockwise"], + ["86%", "28%", "8rem", "gear-counter"], + ]; + return ( +