#NEWLINE# def fade( self , start , end , duration ) : #NEWLINE# #INDENT# self . stop ( ) #NEWLINE# time_start = time . time ( ) #NEWLINE# self . pwm ( PULSE_FREQUENCY , start ) #NEWLINE# def _fade( ) : #NEWLINE# #INDENT# if ( ( time . time ( ) - time_start ) >= duration ) : #NEWLINE# #INDENT# self . duty_cycle ( end ) #NEWLINE# return False #NEWLINE# #UNINDENT# current = ( ( time . time ( ) - time_start ) / duration ) #NEWLINE# brightness = ( start + ( float ( ( end - start ) ) * current ) ) #NEWLINE# self . duty_cycle ( round ( brightness ) ) #NEWLINE# time . sleep ( 0.1 ) #NEWLINE# #UNINDENT# self . fader = AsyncWorker ( _fade ) #NEWLINE# self . fader . start ( ) #NEWLINE# return True