Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
squirreltown
Roku Guru

thanks

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.port=CreateObject("roMessagePort")
m.screen.SetPort(m.port)
m.screen.SetAlphaEnable(true)
m.cursarray = RollCursor(640, 360, 200, &hFF0000FF)
while true
m.screen.Clear(&hebebebFF)
ShowCursor(m.screen)
m.screen.swapbuffers()
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 = {}
cursobject.bm= bitty
cursobject.x = locx
cursobject.ox = locx
cursobject.cx = locx
cursobject.y = locy
cursobject.oy = locy
cursobject.cy = locy
cursobject.rad = diameter/2
cursobject.time = 2.0+add
cursobject.interval = 0.08
cursobject.color= color-(i*16)
cursobject.scale= diameter/900
m.cursarray.Push(cursobject)
add = add+.39
end for
return m.cursarray

End Function
Kinetics Screensavers
0 Kudos
3 REPLIES 3
TheEndless
Channel Surfer

Re: thanks

I see what you did there.. 😉
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)
0 Kudos
Komag
Roku Guru

Re: thanks

Is that the loading or cueing wait thing?

Har har 😛
0 Kudos
MatroxRT
Visitor

Re: thanks

Pretty much made my day.
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.