parabolaScrollEasing

fun parabolaScrollEasing(currentOffset: Float, newOffset: Float, p: Float = 25.0f, density: Float = 4.0f): Float

A parabolic rolling easing curve.

When rolling in the same direction, the farther away from 0, the greater the "resistance"; the closer to 0, the smaller the "resistance";

No drag effect is applied when the scrolling direction is opposite to the currently existing overscroll offset

Note: when p = 50f, its performance should be consistent with iOS

Parameters

currentOffset

Offset value currently out of bounds

newOffset

The offset of the new scroll

p

Key parameters for parabolic curve calculation

density

Without this param, the unit of offset is pixels, so we need this variable to have the same expectations on different devices.