$ show iamjosephmj/flinger
A Kotlin library for Jetpack Compose that provides customizable fling/scroll physics, ported from Android's OverScroller. It offers configurable deceleration, friction, gravity, spline curves, and presets, with snap, adaptive, and pager behaviors. The library is structured as a single artifact with a clean configuration builder pattern, and includes a sample app for demonstration. Physics calculations are isolated in well-tested modules (FlingCalculator, AndroidFlingSpline), and documentation diagrams are regenerable from a self-contained Python script that ports the same math. The codebase demonstrates strong engineering practices with unit tests, migration guides, and consistent Kotlin/Compose idioms.
The LLM identified 3 files worth highlighting for reuse:
Core fling physics calculations for distance and duration based on velocity, friction, and deceleration parameters. Self-contained math logic extracted from Android's OverScroller, reusable for any scroll physics system.
Implements cubic BΓ©zier spline for fling deceleration curves, with precomputed lookup table for performance. Isolated algorithm that can be repurposed for custom animation easing.
Self-contained Python script that ports the library's physics (spline, calculator) to generate SVG diagrams for documentation. Demonstrates a pattern of regenerable, code-derived documentation.