MCPcopy Create free account
hub / github.com/SyntaxUI/syntaxui / generateStars

Function generateStars

src/showcase/components/button/StarWarsButton.tsx:20–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18
19 useEffect(() => {
20 const generateStars = () => {
21 if (buttonRef.current) {
22 const { width, height } = buttonRef.current.getBoundingClientRect()
23 setStars(
24 Array.from({ length: 50 }, (_, i) => ({
25 id: i,
26 x: Math.random() * width,
27 y: Math.random() * height,
28 size: Math.random() * 2 + 1,
29 speed: Math.random() * 50 + 20,
30 })),
31 )
32 }
33 }
34
35 generateStars()
36 window.addEventListener('resize', generateStars)

Callers 1

StarWarsButtonFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected