Fix radial gradient

This commit is contained in:
Zach Latta 2025-05-30 22:13:32 -04:00
parent 9abce6311f
commit 5b0e8779aa
2 changed files with 8 additions and 2 deletions

View file

@ -228,8 +228,11 @@ const ShipPage = () => {
const spotlightRef = useRef()
useEffect(() => {
const handler = event => {
const rect = spotlightRef.current.getBoundingClientRect()
const x = event.clientX - rect.left
const y = event.clientY - rect.top
spotlightRef.current.style.background = `radial-gradient(
circle at ${event.pageX}px ${event.pageY}px,
circle at ${x}px ${y}px,
rgba(0, 0, 0, 0) 10px,
rgba(0, 0, 0, 0.8) 80px
)`

View file

@ -104,8 +104,11 @@ const ShipPage = () => {
const spotlightRef = useRef()
useEffect(() => {
const handler = event => {
const rect = spotlightRef.current.getBoundingClientRect()
const x = event.clientX - rect.left
const y = event.clientY - rect.top
spotlightRef.current.style.background = `radial-gradient(
circle at ${event.pageX}px ${event.pageY}px,
circle at ${x}px ${y}px,
rgba(0, 0, 0, 0) 10px,
rgba(0, 0, 0, 0.8) 80px
)`