Stiff Scroll Effect¶
An Effect to be used with ScrollView to prevent scrolling beyond the bounds, but politely.
A ScrollView constructed with StiffScrollEffect, eg. ScrollView(effect_cls=StiffScrollEffect), will get harder to scroll as you get nearer to its edges. You can scroll all the way to the edge if you want to, but it will take more finger-movement than usual.
Unlike DampedScrollEffect, it is impossible to overscroll with StiffScrollEffect. That means you cannot push the contents of the ScrollView far enough to see what’s beneath them. This is appropriate if the ScrollView contains, eg., a background image, like a desktop wallpaper. Overscrolling may give the impression that there is some reason to overscroll, even if just to take a peek beneath, and that impression may be misleading.
StiffScrollEffect was written by Zachary Spector. His other stuff is at: https://github.com/LogicalDash/ He can be reached, and possibly hired, at: zacharyspector@gmail.com
API - kivymd.effects.stiffscroll¶
- class kivymd.effects.stiffscroll.StiffScrollEffect(**kwargs)¶
Kinetic effect class. See module documentation for more information.
- drag_threshold¶
Minimum distance to travel before the movement is considered as a drag.
drag_thresholdis anNumericPropertyand defaults to ’20sp’.
- min¶
Minimum boundary to stop the scrolling at.
minis anNumericPropertyand defaults to 0.
- max¶
Maximum boundary to stop the scrolling at.
maxis anNumericPropertyand defaults to 0.
- max_friction¶
How hard should it be to scroll, at the worst?
max_frictionis anNumericPropertyand defaults to 1.
- body¶
Proportion of the range in which you can scroll unimpeded.
bodyis anNumericPropertyand defaults to 0.7.
- scroll¶
Computed value for scrolling
scrollis anNumericPropertyand defaults to 0.0.
- transition_min¶
The AnimationTransition function to use when adjusting the friction near the minimum end of the effect.
transition_minis anObjectPropertyand defaults tokivy.animation.AnimationTransition.
- transition_max¶
The AnimationTransition function to use when adjusting the friction near the maximum end of the effect.
transition_maxis anObjectPropertyand defaults tokivy.animation.AnimationTransition.
- target_widget¶
The widget to apply the effect to.
target_widgetis anObjectPropertyand defaults toNone.
- displacement¶
The absolute distance moved in either direction.
displacementis anNumericPropertyand defaults to 0.
- update_velocity(self, dt)¶
Before actually updating my velocity, meddle with
self.frictionto make it appropriate to where I’m at, currently.
- on_value(self, *args)¶
Prevent moving beyond my bounds, and update
self.scroll
- start(self, val, t=None)¶
Start movement with
self.friction=self.base_friction
- update(self, val, t=None)¶
Reduce the impact of whatever change has been made to me, in proportion with my current friction.
- stop(self, val, t=None)¶
Work out whether I’ve been flung.