MCPcopy Create free account
hub / github.com/DavidHDev/react-bits / step

Function step

src/content/Components/DomeGallery/DomeGallery.jsx:275–291  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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 },

Callers

nothing calls this directly

Calls 3

clampFunction · 0.70
wrapAngleSignedFunction · 0.70
applyTransformFunction · 0.70

Tested by

no test coverage detected