Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Level 9


In honor of the date and to say thanks for all the help I've gotten here, I'm open-sourcing this tiny channel which will create a lovely Disney-like forest with lots of happy bunnys hopping around.

'Happy April!

Sub Main()
m.screen=CreateObject("roScreen", true,1280, 720)
m.cursarray = RollCursor(640, 360, 200, &hFF0000FF)
while true
msg = m.port.getmessage()
if type(msg) = "roUniversalControlEvent"
button = msg.getint()
if button=0
exit while
end if
end if
end while
End Sub

Function DrawBitty(size as integer, color as object)
bitty = createObject("robitmap", {width:size, height:size, AlphaEnable:true})
brush = size/50
x = size/2 : y= size/2 : cx = size/2 : cy = size/2 : time = 0 : rad = 2
for q = 0 to 45
for i = 0 to 360
x = cx + sin(time)*rad
y = cy + cos(time)*rad
time = time - .02
bitty.drawrect( x, y, brush,brush, color )
end for
rad = rad+1
end for
return bitty
End Function

Function RotateCursor( cursarray as object, i as integer)

cursarray[i].x = cursarray[i].cx + sin(cursarray[i].time)*cursarray[i].rad
cursarray[i].y = cursarray[i].cy + cos(cursarray[i].time)*cursarray[i].rad
cursarray[i].time = cursarray[i].time - cursarray[i].interval

End Function

Sub ShowCursor(screen as object)

for i = 0 to m.cursarray.count()-1
RotateCursor( m.cursarray, i)
end for
for i = 0 to m.cursarray.count()-1
screen.drawscaledobject( m.cursarray[i].x, m.cursarray[i].y, m.cursarray[i].scale, m.cursarray[i].scale, m.cursarray[i].bm, m.cursarray[i].color)
end for

End sub

Function RollCursor(locx as integer, locy as integer, diameter as integer, color as object)

bitty = Drawbitty(diameter, color)
add = 0
m.cursarray = []
for i = 0 to 15
cursobject = {} bitty
cursobject.x = locx
cursobject.ox = locx = locx
cursobject.y = locy
cursobject.oy = locy = locy
cursobject.rad = diameter/2
cursobject.time = 2.0+add
cursobject.interval = 0.08
cursobject.color= color-(i*16)
cursobject.scale= diameter/900
add = add+.39
end for
return m.cursarray

End Function
Kinetics Screensavers
0 Kudos
3 Replies
Level 9

Re: thanks

I see what you did there.. Smiley Wink
My Channels: - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
Level 10

Re: thanks

Is that the loading or cueing wait thing?

Har har Smiley Tongue
0 Kudos
Level 7

Re: thanks

Pretty much made my day.
0 Kudos