fix(complement-race): fix react-spring interpolation TypeScript errors
Fixed TypeScript errors in transform interpolation by using correct react-spring syntax: to([spring1, spring2, spring3], (a, b, c) => ...) instead of the incorrect spring1.to((a, b, c) => ..., spring2, spring3) syntax. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { useSpring, useSprings, animated } from '@react-spring/web'
|
import { useSpring, useSprings, animated, to } from '@react-spring/web'
|
||||||
import { useMemo, useRef } from 'react'
|
import { useMemo, useRef } from 'react'
|
||||||
import type { PlayerState } from '@/arcade-games/complement-race/types'
|
import type { PlayerState } from '@/arcade-games/complement-race/types'
|
||||||
import type { RailroadTrackGenerator } from '../../lib/RailroadTrackGenerator'
|
import type { RailroadTrackGenerator } from '../../lib/RailroadTrackGenerator'
|
||||||
@@ -146,10 +146,9 @@ export function GhostTrain({
|
|||||||
<g ref={ghostRef} data-component="ghost-train" data-player-id={player.id}>
|
<g ref={ghostRef} data-component="ghost-train" data-player-id={player.id}>
|
||||||
{/* Ghost locomotive - animated */}
|
{/* Ghost locomotive - animated */}
|
||||||
<animated.g
|
<animated.g
|
||||||
transform={locomotiveSpring.x.to(
|
transform={to(
|
||||||
(x, y, rot) => `translate(${x}, ${y}) rotate(${rot}) scale(-1, 1)`,
|
[locomotiveSpring.x, locomotiveSpring.y, locomotiveSpring.rotation],
|
||||||
locomotiveSpring.y,
|
(x, y, rot) => `translate(${x}, ${y}) rotate(${rot}) scale(-1, 1)`
|
||||||
locomotiveSpring.rotation
|
|
||||||
)}
|
)}
|
||||||
opacity={locomotiveSpring.opacity}
|
opacity={locomotiveSpring.opacity}
|
||||||
>
|
>
|
||||||
@@ -208,10 +207,9 @@ export function GhostTrain({
|
|||||||
{carSprings.map((spring, index) => (
|
{carSprings.map((spring, index) => (
|
||||||
<animated.g
|
<animated.g
|
||||||
key={`car-${index}`}
|
key={`car-${index}`}
|
||||||
transform={spring.x.to(
|
transform={to(
|
||||||
(x, y, rot) => `translate(${x}, ${y}) rotate(${rot}) scale(-1, 1)`,
|
[spring.x, spring.y, spring.rotation],
|
||||||
spring.y,
|
(x, y, rot) => `translate(${x}, ${y}) rotate(${rot}) scale(-1, 1)`
|
||||||
spring.rotation
|
|
||||||
)}
|
)}
|
||||||
opacity={spring.opacity}
|
opacity={spring.opacity}
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user