StiffScrollEffect#
#
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.stiffscroll
#
- class kivymd.effects.stiffscroll.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_threshold
is anNumericProperty
and defaults to ’20sp’.
- min#
Minimum boundary to stop the scrolling at.
min
is anNumericProperty
and defaults to 0.
- max#
Maximum boundary to stop the scrolling at.
max
is anNumericProperty
and defaults to 0.
- max_friction#
How hard should it be to scroll, at the worst?
max_friction
is anNumericProperty
and defaults to 1.
- body#
Proportion of the range in which you can scroll unimpeded.
body
is anNumericProperty
and defaults to 0.7.
- scroll#
Computed value for scrolling
scroll
is anNumericProperty
and defaults to 0.0.
- transition_min#
The AnimationTransition function to use when adjusting the friction near the minimum end of the effect.
transition_min
is anObjectProperty
and defaults tokivy.animation.AnimationTransition
.
- transition_max#
The AnimationTransition function to use when adjusting the friction near the maximum end of the effect.
transition_max
is anObjectProperty
and defaults tokivy.animation.AnimationTransition
.
- target_widget#
The widget to apply the effect to.
target_widget
is anObjectProperty
and defaults toNone
.
- displacement#
The absolute distance moved in either direction.
displacement
is anNumericProperty
and defaults to 0.
- update_velocity(dt)#
Before actually updating my velocity, meddle with
self.friction
to make it appropriate to where I’m at, currently.
- on_value(*args)#
Prevent moving beyond my bounds, and update
self.scroll
- start(val, t=None)#
Start movement with
self.friction
=self.base_friction
- update(val, t=None)#
Reduce the impact of whatever change has been made to me, in proportion with my current friction.
- stop(val, t=None)#
Work out whether I’ve been flung.