This works for me... Feel free to steal it.
😉Function FadeToBlack( fadeStep = 1 As Integer ) As Object
canvas = CreateObject( "roImageCanvas" )
fade = {
Color: "#00000000",
TargetRect: { x: 0, y: 0, w: 1280, h: 720 }
}
canvas.SetLayer( 0, fade )
canvas.Show()
Sleep( 25 )
For value = 0 To 255 Step fadeStep
fade.Color = "#" + ByteToHex( value ) + "000000"
canvas.SetLayer( 0, fade )
Sleep( 25 )
Next
Return canvas
End Function
Function ByteToHex( byte As Integer ) As String
If byte > 255 Then
byte = 255
End If
hexValues = "0123456789ABCDEF"
hex = hexValues.Mid( Int( byte / 16 ), 1 ) + hexValues.Mid( Mod( byte, 16 ), 1 )
Return hex
End Function
' This function is not at all efficient, but the Roku's
' division is very sketchy at higher numbers
Function Mod( a as Integer, b as Integer ) as Integer
If a = 0 Or b = 0 Or a = b Then
Return 0
ElseIf a < b Then
Return a
Else
x = a - b
While x >= b
x = x - b
End While
Return x
End If
End Function
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)