@@ -167,7 +167,7 @@ def transition(self, transition=None):
167167 if transition :
168168 director .replace ( transition (
169169 self .scenes [ self .scene_p ],
170- duration = 1
170+ # duration = 1
171171 )
172172 )
173173 else :
@@ -191,99 +191,13 @@ def on_key_press(self, keyp, mod):
191191 if keyp in (key .F1 ,):
192192 director .push ( self .target )
193193
194- class ControlLayer (cocos .layer .Layer ):
195- is_event_handler = True
196-
197- def on_enter ( self ):
198- super (ControlLayer , self ).on_enter ()
199-
200- ft_title = font .load ( "Arial" , 32 )
201- ft_subtitle = font .load ( "Arial" , 18 )
202- ft_help = font .load ( "Arial" , 16 )
203-
204- self .text_title = font .Text (ft_title , "Transition Demos" ,
205- x = 5 ,
206- y = 480 ,
207- anchor_x = font .Text .LEFT ,
208- anchor_y = font .Text .TOP )
209-
210- self .text_subtitle = font .Text (ft_subtitle , transition_list [current_transition ].__name__ ,
211- x = 5 ,
212- y = 400 ,
213- anchor_x = font .Text .LEFT ,
214- anchor_y = font .Text .TOP )
215-
216- self .text_help = font .Text (ft_help ,"Press LEFT / RIGHT for prev/next example, ENTER to restart example" ,
217- x = 320 ,
218- y = 20 ,
219- anchor_x = font .Text .CENTER ,
220- anchor_y = font .Text .CENTER )
221-
222- def step ( self , df ):
223- self .text_help .draw ()
224-
225- self .text_subtitle .text = transition_list [current_transition ].__name__
226- self .text_subtitle .draw ()
227- self .text_title .draw ()
228-
229- def on_key_press ( self , k , m ):
230- global current_transition , control_p
231- if k == key .LEFT :
232- current_transition = (current_transition - 1 )% len (transition_list )
233- if k == key .RIGHT :
234- current_transition = (current_transition + 1 )% len (transition_list )
235- if k == key .ENTER :
236- director .replace ( transition_list [current_transition ](
237- control_list [control_p ],
238- (control_list [(control_p + 1 )% len (control_list )] ),
239- 2 )
240- )
241- control_p = (control_p + 1 ) % len (control_list )
242- return True
243- if k == key .ESCAPE :
244- director .scene .end ()
245- return True
246-
247- class GrossiniLayer (cocos .layer .Layer ):
248- def __init__ ( self ):
249- super ( GrossiniLayer , self ).__init__ ()
250-
251- g = Sprite ('grossini.png' , (320 ,240 ))
252-
253- self .add ( g )
254-
255- rot = Rotate ( 180 , 5 )
256-
257- g .do ( Repeat ( rot ) )
258-
259-
260- class GrossiniLayer2 (cocos .layer .Layer ):
261- def __init__ ( self ):
262- super ( GrossiniLayer2 , self ).__init__ ()
263-
264- rot = Rotate ( 180 , 5 )
265-
266- g = Sprite ('grossinis_sister1.png' , (490 ,240 ))
267- self .add ( g )
268- g .do ( Repeat ( rot ) )
269-
270- g = Sprite ('grossinis_sister2.png' , (150 ,240 ))
271- self .add ( g )
272- g .do ( Repeat ( rot ) )
273194
274195if __name__ == "__main__" :
275196 aspect = 1280 / float (800 )
276197 director .init ( resizable = True , width = 640 , height = 480 )
277198 director .window .set_fullscreen (False )
278199 x ,y = director .get_window_size ()
279- #background = BackgroundLayer("background.png")
280- #background = BackgroundLayer("coconut.jpg")
281- background = cocos .layer .ColorLayer (0 ,0 ,0 ,255 )
282200
283- transition_list = [
284- JumpZoomTransition
285- ]
286- current_transition = 0
287201
288202 scenes = [
289203 cocos .scene .Scene (
@@ -442,26 +356,34 @@ def __init__( self ):
442356 transitions = [None ]* (len (scenes )- 1 )
443357 all_t = [
444358 'ZoomTransition' ,
445- 'RotoZoomTransition' ,'JumpZoomTransition' ,
446-
447- 'SlideInLTransition' ,'SlideInRTransition' ,
448- 'SlideInBTransition' ,'SlideInTTransition' ,
449359
450- 'FlipX3DTransition' ,'FadeTRTransition' ,
451- 'FlipY3DTransition' ,'FlipAngular3DTransition' ,
360+ 'FlipX3DTransition' ,
361+ 'FlipY3DTransition' ,'FlipAngular3DTransition' ,
452362
453- 'ShuffleTransition' ,
454363 'TurnOffTilesTransition' ,
364+
365+ 'ShrinkGrowTransition' ,
366+
455367 'FadeTRTransition' , 'FadeBLTransition' ,
456368 'FadeUpTransition' , 'FadeDownTransition' ,
457369
458- 'ShrinkGrowTransition' ,
370+ 'SplitRowsTransition' , 'SplitColsTransition' ,
371+
372+ 'RotoZoomTransition' ,
373+
374+ 'FadeTransition' ,
375+
459376 'CornerMoveTransition' ,
460377 'EnvelopeTransition' ,
461378
462- 'SplitRowsTransition' , 'SplitColsTransition' ,
379+ 'MoveInLTransition' ,'MoveInRTransition' ,
380+ 'MoveInBTransition' ,'MoveInTTransition' ,
381+
382+ 'ShuffleTransition' ,
383+ 'JumpZoomTransition' ,
384+
385+ ]
463386
464- 'FadeTransition' ,]
465387 transitions = [ getattr (cocos .scenes .transitions , all_t [i % len (all_t )])
466388 for i in range (len (scenes )- 1 ) ]
467389
0 commit comments