Table Of Contents
Damped scroll effect¶
Added in version 3.0.0.
This scroll effect is inspired by Flutter’s BouncingScrollPhysics, which mimics iOS-style scrolling behavior. Key features:
Logarithmic resistance during overscroll drag (rubber band feel)
Critically damped spring for bounce-back (no oscillation)
Exponential friction for momentum scrolling
Mathematically guaranteed stability
IMPLEMENTATION NOTES:¶
This is a clean-room implementation based on understanding the physics and algorithms used in Flutter and iOS, not a direct port of the code.
Mathematical formulas, physical laws, and algorithms are not subject to copyright. This implementation uses standard physics equations and mathematical transformations that are in the public domain.
Differences from the original DampedScrollEffect:¶
This implementation is different from the original DampedScrollEffect that was introduced in Kivy 1.7.0. The original DampedScrollEffect had a numerical instability issue. This implementation uses critical damping to ensure the effect is stable. Additionally the properties in the effect are different, and allow for more control over the effect.
- class kivy.effects.dampedscroll.DampedScrollEffect(**kwargs)[source]¶
Bases:
ScrollEffectFlutter-inspired scroll effect with iOS-style rubber banding.
This implementation uses:
Logarithmic resistance for overscroll (increasing resistance as you pull)
Critically damped spring for bounce-back (no oscillation)
Exponential friction for smooth momentum
See module documentation for more information.
- min_overscroll¶
An overscroll less than this amount will be normalized to 0.
min_overscrollis aNumericPropertyand defaults to .5.
- rubber_band_coeff¶
Rubber band resistance coefficient. Higher values = less resistance.
Flutter/iOS typically use ~0.55. Lower values (0.3-0.4) feel stiffer, higher values (0.6-0.8) feel more elastic.
rubber_band_coeffis aNumericPropertyand defaults to 0.55.
- spring_mass¶
Mass for spring simulation (affects bounce-back speed).
spring_massis aNumericPropertyand defaults to 1.0.
- spring_stiffness¶
Stiffness for spring simulation (affects bounce-back speed).
spring_stiffnessis aNumericPropertyand defaults to 100.0.