import { AnimatedBeam } from '@hanzo/ui'
A beam draws itself, over and over, from one node to another inside a shared container.
export function Default() {const container = useRef<GuiElement>(null)const from = useRef<GuiElement>(null)const to = useRef<GuiElement>(null)return (<Stage ref={container} height={160}><Dot ref={from}>A</Dot><Dot ref={to}>B</Dot><AnimatedBeam containerRef={container} fromRef={from} toRef={to} /></Stage>)}
`gradientStartColor`/`gradientStopColor` set the flowing stroke's gradient, `duration` its loop.
export function CustomColors() {const container = useRef<GuiElement>(null)const from = useRef<GuiElement>(null)const to = useRef<GuiElement>(null)return (<Stage ref={container} height={160}><Dot ref={from}>In</Dot><Dot ref={to}>Out</Dot><AnimatedBeam containerRef={container} fromRef={from} toRef={to} duration={1.5} gradientStartColor="#F97316" gradientStopColor="#DB2777" /></Stage>)}
Three spokes into one node: one container, one beam per pair, each staggered by its own `delay`.
export function Hub() {const container = useRef<GuiElement>(null)const hub = useRef<GuiElement>(null)const one = useRef<GuiElement>(null)const two = useRef<GuiElement>(null)const three = useRef<GuiElement>(null)return (<Stage ref={container} height={220}><YStack gap="$6"><Dot ref={one} size={40}>1</Dot><Dot ref={two} size={40}>2</Dot><Dot ref={three} size={40}>3</Dot></YStack><Dot ref={hub} size={56}>Hub</Dot><AnimatedBeam containerRef={container} fromRef={one} toRef={hub} /><AnimatedBeam containerRef={container} fromRef={two} toRef={hub} delay={0.4} /><AnimatedBeam containerRef={container} fromRef={three} toRef={hub} delay={0.8} /></Stage>)}
export type AnimatedBeamProps = React.SVGAttributes<SVGSVGElement> & {/** Seconds for one pass of the flowing stroke. */duration?: number/** Seconds before its first pass. */delay?: numberpathColor?: stringpathWidth?: numbergradientStartColor?: stringgradientStopColor?: stringcontainerRef?: AnchorfromRef?: AnchortoRef?: Anchor}