Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- platform.apilevel = '2.4'
- time=0
- screen1 = {}
- screen2 = {}
- screen3 = {}
- screenlist = {}
- screencount = 0
- w=platform.window:width()
- h=platform.window:height()
- pallet = {}
- plasma = {}
- function on.paint(gc)
- timer.start(0.01)
- time=timer.getMilliSecCounter()/10
- local x = 0
- local y=0
- while (x<w) do
- while (y<h) do
- tempcol = math.floor((plasma[x][y]+ time) %256)
- color_r = math.floor(pallet[tempcol].r)
- color_g = math.floor(pallet[tempcol].g)
- color_b = math.floor(pallet[tempcol].b)
- gc:setColorRGB(color_r,color_g,color_b)
- gc:fillRect(x,y,5,5)
- y = y +5
- end
- x=x+5
- y=0
- end
- screencount = screencount +1
- if (screencount >2) then
- screencount = 0
- end
- time=math.random(255)
- end
- function dist(a,b,c,d)
- return math.sqrt(((a - c) * (a - c) + (b - d) * (b - d)))
- end
- function on.timer()
- time = timer.getMilliSecCounter()/1000
- platform.window:invalidate()
- end
- function on.construction()
- r=0
- g=0
- b=0
- for i=0,256 do
- pallet[i]={r=math.floor(128.0 + 128 * math.sin(3.1415 * i/ 16.0)),g=math.floor(128.0 + 128 * math.sin(3.1415 * i / 128.0)),b=0}
- end
- for a=0,w do
- plasma[a] = {}
- for b=0,h do
- plasma[a][b] = math.floor(
- 128.0 + (128.0 * math.sin(a / 16.0))
- + 128.0 + (128.0 * math.sin(b / 16.0))
- ) /2
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement