a bit less computation

This commit is contained in:
Gavin McDonald
2025-07-03 21:05:04 -04:00
parent 8cbf281ef8
commit d3eb6f1b46
4 changed files with 28 additions and 22 deletions

View File

@@ -82,9 +82,16 @@ export default function TiltCard({
const rotateX = ((y - centerY) / centerY) * -20;
const rotateY = ((x - centerX) / centerX) * 20;
const percentX = x / rect.width;
const percentY = y / rect.height;
const newTilt: Tilt[] = [];
newTilt[cardIndex] = { rotateX, rotateY };
newTilt[cardIndex] = {
percentX,
percentY,
rotateX,
rotateY,
};
setTilt(newTilt);
}, thirtyFPS);