6262 "Bounce Out" : Easing .BOUNCE_OUT
6363}
6464
65- # We need these for sorting them later; they're in reverse order since we draw bottom-up.
66- function_names = ["Bounce" , "Elastic" , "Back" , "Circ" , "Expo" , "Quint" , "Quart" , "Cubic" , "Quad" , "Sine" , "Linear" ]
65+ # We need these for sorting them later;
66+ # they're in reverse order since we draw bottom-up.
67+ function_names = ["Bounce" , "Elastic" , "Back" , "Circ" , "Expo" , "Quint" ,
68+ "Quart" , "Cubic" , "Quad" , "Sine" , "Linear" ]
6769
6870def px_to_pt (px : int ) -> int :
6971 return round (px // (4 / 3 ))
@@ -109,11 +111,20 @@ def __init__(self):
109111
110112 self .random_colors = [arcade .types .Color .random (a = 255 ) for _ in range (len (self .areas ))]
111113
112- self .title_text = arcade .Text ("Easing Functions" , buffer , self .window .rect .top - buffer , font_size = px_to_pt (int (rect_height - buffer )),
113- font_name = "Josefin Sans" , anchor_y = "top" )
114- self .subtitle_text = arcade .Text ("Press [SPACE] to pause/unpause." , self .window .rect .right - buffer , self .window .rect .top - buffer ,
115- font_size = px_to_pt (int (rect_height - buffer ) // 2 ), font_name = "Josefin Sans" , color = arcade .color .ARCADE_YELLOW ,
116- anchor_y = "top" , anchor_x = "right" )
114+ self .title_text = arcade .Text ("Easing Functions" ,
115+ buffer ,
116+ self .window .rect .top - buffer ,
117+ font_size = px_to_pt (int (rect_height - buffer )),
118+ font_name = "Josefin Sans" ,
119+ anchor_y = "top" )
120+ self .subtitle_text = arcade .Text ("Press [SPACE] to pause/unpause." ,
121+ self .window .rect .right - buffer ,
122+ self .window .rect .top - buffer ,
123+ font_size = px_to_pt (int (rect_height - buffer ) // 2 ),
124+ font_name = "Josefin Sans" ,
125+ color = arcade .color .ARCADE_YELLOW ,
126+ anchor_y = "top" ,
127+ anchor_x = "right" )
117128
118129 self .labels = []
119130 self .progress_labels = []
@@ -123,11 +134,17 @@ def __init__(self):
123134 for n , a in enumerate (self .areas ):
124135 name = self .idx_to_func_name (n )
125136 func = easing_functions [name ]
126- label = arcade .Text (func .__name__ , a .left , a .bottom , font_size = px_to_pt (int (a .height / 2 - buffer )),
127- font_name = "Fira Code" , batch = self .text_batch )
137+ label = arcade .Text (func .__name__ , a .left , a .bottom ,
138+ font_size = px_to_pt (int (a .height / 2 - buffer )),
139+ font_name = "Fira Code" ,
140+ batch = self .text_batch )
128141 self .labels .append (label )
129- progress_label = arcade .Text ("0.00" , a .right , a .bottom , font_size = px_to_pt (int (a .height / 2 - buffer )),
130- font_name = "Josefin Sans" , bold = "light" , anchor_x = "right" , batch = self .text_batch )
142+ progress_label = arcade .Text ("0.00" , a .right , a .bottom ,
143+ font_size = px_to_pt (int (a .height / 2 - buffer )),
144+ font_name = "Josefin Sans" ,
145+ bold = "light" ,
146+ anchor_x = "right" ,
147+ batch = self .text_batch )
131148 self .progress_labels .append (progress_label )
132149 sprite = SpriteCircle (int (a .height / 4 ), arcade .color .ARCADE_YELLOW )
133150 sprite .left = a .left
0 commit comments