2828
2929
3030@property
31- def throttle_effect (self ):
32- """The furtherest the throttle effect can randomly set the widget value relative
31+ def fluctuation_amplitude (self ):
32+ """The furtherest the fluctuation effect can randomly set the widget value relative
3333 to its true position, in either direction.
3434 """
35- return self ._throttle_setting
35+ return self ._fluctuation_amplitude
3636
3737
38- @throttle_effect .setter
39- def throttle_effect (self , setting ):
38+ @fluctuation_amplitude .setter
39+ def fluctuation_amplitude (self , setting ):
4040 if setting < 0 :
41- raise ValueError ("Throttle effect setting must be larger than 0" )
41+ raise ValueError ("Fluctuation effect setting must be larger than 0" )
4242 if setting :
43- self ._throttle_hold_value = getattr (self , self ._value_name )
44- self ._throttle_setting = setting
43+ self ._fluctuation_hold_value = getattr (self , self ._value_name )
44+ self ._fluctuation_amplitude = setting
4545
4646
4747@property
48- def throttle_effect_move_rate (self ):
49- """The speed at which the throttle effect moves the widget vaalue
48+ def fluctuation_move_rate (self ):
49+ """The speed at which the fluctuation effect moves the widget vaalue
5050 per update"""
5151
52- return self ._throttle_move_rate
52+ return self ._fluctuation_move_rate
5353
5454
55- @throttle_effect_move_rate .setter
56- def throttle_effect_move_rate (self , rate ):
57- self ._throttle_move_rate = rate
55+ @fluctuation_move_rate .setter
56+ def fluctuation_move_rate (self , rate ):
57+ self ._fluctuation_move_rate = rate
5858
5959
60- def throttle_update (self ):
61- """Updates the widget value and propagates the throttle effect refresh"""
60+ def update_fluctuation (self ):
61+ """Updates the widget value and propagates the fluctuation effect refresh"""
6262
63- if self ._throttle_setting == 0 :
64- self ._throttle_destination = None
63+ if self ._fluctuation_amplitude == 0 :
64+ self ._fluctuation_destination = None
6565 return
6666
67- if self ._throttle_destination in (None , self ._throttle_hold_value ):
68- limit_bound = self ._throttle_setting * 10
69- self ._throttle_destination = (
70- random .uniform (- limit_bound , limit_bound ) / 10 + self ._throttle_hold_value
67+ if self ._fluctuation_destination in (None , self ._fluctuation_hold_value ):
68+ limit_bound = self ._fluctuation_amplitude * 10
69+ self ._fluctuation_destination = (
70+ random .uniform (- limit_bound , limit_bound ) / 10 + self ._fluctuation_hold_value
7171 )
7272
7373 value = getattr (self , self ._value_name )
7474 value = (
75- value + self ._throttle_move_rate
76- if self ._throttle_destination > value
77- else value - self ._throttle_move_rate
75+ value + self ._fluctuation_move_rate
76+ if self ._fluctuation_destination > value
77+ else value - self ._fluctuation_move_rate
7878 )
7979 setattr (self , self ._value_name , value )
8080
8181 threshold_check = (
82- value >= self ._throttle_destination
83- if self ._throttle_destination >= self ._throttle_hold_value
84- else value <= self ._throttle_destination
82+ value >= self ._fluctuation_destination
83+ if self ._fluctuation_destination >= self ._fluctuation_hold_value
84+ else value <= self ._fluctuation_destination
8585 )
8686 if threshold_check :
87- self ._throttle_destination = self ._throttle_hold_value
87+ self ._fluctuation_destination = self ._fluctuation_hold_value
8888
8989
90- def hook_throttle_effect (widget_class , value_name ):
90+ def hook_fluctuation_effect (widget_class , value_name ):
9191 """Adds the throttle effect for the given classes
9292
9393 :param widget_classes: The widgets that should have this effect hooked
@@ -103,18 +103,18 @@ def hook_throttle_effect(widget_class, value_name):
103103 from displayio_dial import Dial
104104 from displayio_effects import throttle_effect
105105
106- throttle_effect.hook_throttle_effect (Dial, "value")
106+ fluctuation_effect.hook_fluctuation_effect (Dial, "value")
107107
108108 """
109109
110110 setattr (widget_class , "_value_name" , value_name )
111111
112- setattr (widget_class , "_throttle_destination " , None )
113- setattr (widget_class , "_throttle_value " , 0 )
112+ setattr (widget_class , "_fluctuation_destination " , None )
113+ setattr (widget_class , "_fluctuation_hold_value " , 0 )
114114
115- setattr (widget_class , "throttle_effect " , throttle_effect )
116- setattr (widget_class , "_throttle_effect " , 0 )
117- setattr (widget_class , "throttle_effect_move_rate " , throttle_effect_move_rate )
118- setattr (widget_class , "_throttle_move_rate " , 0.1 )
115+ setattr (widget_class , "fluctuation_amplitude " , fluctuation_amplitude )
116+ setattr (widget_class , "_fluctuation_amplitude " , 0 )
117+ setattr (widget_class , "fluctuation_move_rate " , fluctuation_move_rate )
118+ setattr (widget_class , "_fluctuation_move_rate " , 0.1 )
119119
120- setattr (widget_class , "throttle_update " , throttle_update )
120+ setattr (widget_class , "update_fluctuation " , update_fluctuation )
0 commit comments