"use client"; import { forwardRef } from "react"; type Coin3DProps = { frontLabel: string; backLabel: string; /** Kantenlänge in px */ size?: number; /** Endlos-Idle-Drehung (Hero) */ spin?: boolean; /** * Achse, um die die Münze rotiert. Bestimmt, wie die Rückseite * vorgedreht wird, damit ihr Text lesbar bleibt. * "x" = Flip um die X-Achse (Tool), "y" = Drehung um die Y-Achse (Hero). */ spinAxis?: "x" | "y"; className?: string; }; /** Gestapelte Kreisscheiben erzeugen die Münzdicke. */ const EDGE_LAYERS = [-3, -2, -1, 0, 1, 2, 3]; /** * Echte 3D-CSS-Münze. Der forwarded ref zeigt auf das rotierende * Innen-Element, damit GSAP `rotationX` flippen kann. */ const Coin3D = forwardRef(function Coin3D( { frontLabel, backLabel, size = 168, spin = false, spinAxis = "x", className = "" }, ref, ) { return (
{EDGE_LAYERS.map((z) => (
))}
{frontLabel}
{backLabel}
); }); export default Coin3D;