class FadeTransition(TransitionScene): """Fade out the outgoing scene and then fade in the incoming scene. Optionally supply the color to fade to in-between as an RGB color tuple. """ def __init__(self, *args, **kwargs): color = kwargs.pop("color", (0, 0, 0)) + (0,) super(FadeTransition, self).__init__(*args, **kwargs) self.fadelayer = ColorLayer(*color) self.in_scene.visible = False self.add(self.fadelayer, z=2) def on_enter(self): super(FadeTransition, self).on_enter() self.fadelayer.do( FadeIn(duration=self.duration / 2.0) + CallFunc(self.hide_out_show_in) + FadeOut(duration=self.duration / 2.0) + CallFunc(self.finish) ) def on_exit(self): super(FadeTransition, self).on_exit() self.remove(self.fadelayer)
def set_slide(self, slide, change="normal"): self.get("clock").clock_shown(slide.show_clock) out_layer = self.get("slide") in_layer = self.__get_slide_layer(slide) try: self.remove("temp") except Exception: pass # no transition running. try: self.remove("temp_col") except Exception: pass # no transition running. self.remove("slide") self.add(out_layer, z=1, name="temp") self.add(in_layer, z=0, name="slide") transition = config.effect_mapping[change][slide.effect] logger.debug("Changing slide with transition: %s", transition) if transition == "tile_swipe": out_layer.do(FadeOutBLTiles(grid=(16, 9), duration=1) + Hide() + StopGrid()) elif transition == "crossfade": out_layer.do(FadeOut(duration=1)) elif transition == "fade_red": col_layer = ColorLayer(255, 0, 0, 0) self.add(col_layer, z=1.1, name="temp_col") col_layer.do(FadeIn(duration=0.3) + Delay(0.5) + FadeOut(duration=1.5)) out_layer.do(Delay(0.3) + Hide()) else: out_layer.do(Hide())
def set_slide(self, slide, change='normal'): self.get('clock').clock_shown(slide.show_clock) out_layer=self.get('slide') in_layer=self.__get_slide_layer(slide) try: self.remove('temp') except Exception: pass # no transition running. try: self.remove('temp_col') except Exception: pass # no transition running. self.remove('slide') self.add(out_layer, z=1, name='temp') self.add(in_layer, z=0, name='slide') transition=config.effect_mapping[change][slide.effect] logger.debug("Changing slide with transition: %s", transition) if transition == 'tile_swipe': out_layer.do(FadeOutBLTiles(grid=(16, 9), duration=1) + Hide() + StopGrid()) elif transition == 'crossfade': out_layer.do(FadeOut(duration=1)) elif transition == 'fade_red': col_layer=ColorLayer(255, 0, 0, 0) self.add(col_layer, z=1.1, name='temp_col') col_layer.do(FadeIn(duration=0.3)+Delay(0.5)+FadeOut(duration=1.5)) out_layer.do(Delay(0.3) + Hide()) else: out_layer.do(Hide())
class FadeTransition(TransitionScene): '''Fade out the outgoing scene and then fade in the incoming scene.''' def __init__( self, *args, **kwargs ): super(FadeTransition, self ).__init__( *args, **kwargs) self.fadelayer = ColorLayer(0,0,0,0) self.in_scene.visible = False self.add( self.fadelayer, z=2 ) def on_enter( self ): super( FadeTransition, self).on_enter() self.fadelayer.do( FadeIn( duration=self.duration/2.0) + \ CallFunc( self.hide_out_show_in) + \ FadeOut( duration=self.duration /2.0 ) + \ CallFunc( self.finish) ) def on_exit( self ): super( FadeTransition, self).on_exit() self.remove( self.fadelayer )
class FadeTransition(TransitionScene): '''Fade out the outgoing scene and then fade in the incoming scene. Optionally supply the color to fade to in-between as an RGB color tuple. ''' def __init__( self, *args, **kwargs ): color = kwargs.pop('color', (0, 0, 0)) + (0,) super(FadeTransition, self ).__init__( *args, **kwargs) self.fadelayer = ColorLayer(*color) self.in_scene.visible = False self.add( self.fadelayer, z=2 ) def on_enter( self ): super( FadeTransition, self).on_enter() self.fadelayer.do( FadeIn( duration=self.duration/2.0) + \ CallFunc( self.hide_out_show_in) + \ FadeOut( duration=self.duration /2.0 ) + \ CallFunc( self.finish) ) def on_exit( self ): super( FadeTransition, self).on_exit() self.remove( self.fadelayer )