r/reactnative • u/runtimeterror007 • 14m ago
Real-time 3D exercise demos in React Native, ~1 KB of code per exercise
Saw the stickman exercise post going around and wanted to share how I solved the same thing differently in my fitness app (Expo + three.js).
Same goal: I didn't want people leaving the app to check form on YouTube, and I didn't want to ship hundreds of MB of videos.
What it does. Each exercise plays a rigged 3D athlete doing the rep on the actual machine. You can drag to rotate around it and pinch to zoom, and the muscles being worked glow.
How. The trick is that almost nothing is a file. There's one rigged character model (~1 MB) and the rest is code. Each movement is a small spec (four phases, grip, camera angles, which muscles to light up) plus a function that poses the skeleton at any point in the rep. All 31 pieces of gym equipment, racks, cable towers, leg press, pec deck, are built from basic shapes in code. No model files for any of them.
Size. 100 exercises live right now. All the 3D code together is ~123 KB compressed, so roughly 1 KB per exercise, plus the one-time character.
Trade-off. It's heavier than a stickman (that 1 MB model, and it needs a GL view), but you get a real human on real equipment, which helps more with stuff like grip and bench angle.
Rendering is expo-gl + three.js.
Would love feedback, good or bad. Especially: does the realistic look help you, or would you rather have something simpler?