()
| 273 | const stopThreshold = 0.015 - 0.01 * d; |
| 274 | const maxFrames = Math.round(90 + 270 * d); |
| 275 | const step = () => { |
| 276 | vX *= frictionMul; |
| 277 | vY *= frictionMul; |
| 278 | if (Math.abs(vX) < stopThreshold && Math.abs(vY) < stopThreshold) { |
| 279 | inertiaRAF.current = null; |
| 280 | return; |
| 281 | } |
| 282 | if (++frames > maxFrames) { |
| 283 | inertiaRAF.current = null; |
| 284 | return; |
| 285 | } |
| 286 | const nextX = clamp(rotationRef.current.x - vY / 200, -maxVerticalRotationDeg, maxVerticalRotationDeg); |
| 287 | const nextY = wrapAngleSigned(rotationRef.current.y + vX / 200); |
| 288 | rotationRef.current = { x: nextX, y: nextY }; |
| 289 | applyTransform(nextX, nextY); |
| 290 | inertiaRAF.current = requestAnimationFrame(step); |
| 291 | }; |
| 292 | stopInertia(); |
| 293 | inertiaRAF.current = requestAnimationFrame(step); |
| 294 | }, |
nothing calls this directly
no test coverage detected