Advertisement
Guest User

Untitled

a guest
Mar 4th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. platform.apilevel = '2.4'
  2. time=0
  3. screen1 = {}
  4. screen2 = {}
  5. screen3 = {}
  6. screenlist = {}
  7. screencount = 0
  8. w=platform.window:width()
  9. h=platform.window:height()
  10. pallet = {}
  11. plasma = {}
  12. function on.paint(gc)
  13. timer.start(0.01)
  14. time=timer.getMilliSecCounter()/10
  15. local x = 0
  16. local y=0
  17.  
  18. while (x<w) do
  19. while (y<h) do
  20. tempcol = math.floor((plasma[x][y]+ time) %256)
  21. color_r = math.floor(pallet[tempcol].r)
  22. color_g = math.floor(pallet[tempcol].g)
  23. color_b = math.floor(pallet[tempcol].b)
  24.  
  25. gc:setColorRGB(color_r,color_g,color_b)
  26. gc:fillRect(x,y,5,5)
  27. y = y +5
  28. end
  29. x=x+5
  30. y=0
  31. end
  32. screencount = screencount +1
  33. if (screencount >2) then
  34. screencount = 0
  35. end
  36. time=math.random(255)
  37.  
  38. end
  39.  
  40.  
  41. function dist(a,b,c,d)
  42. return math.sqrt(((a - c) * (a - c) + (b - d) * (b - d)))
  43. end
  44.  
  45. function on.timer()
  46. time = timer.getMilliSecCounter()/1000
  47. platform.window:invalidate()
  48. end
  49.  
  50.  
  51. function on.construction()
  52. r=0
  53. g=0
  54. b=0
  55. for i=0,256 do
  56. 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}
  57. end
  58.  
  59. for a=0,w do
  60. plasma[a] = {}
  61. for b=0,h do
  62. plasma[a][b] = math.floor(
  63. 128.0 + (128.0 * math.sin(a / 16.0))
  64. + 128.0 + (128.0 * math.sin(b / 16.0))
  65. ) /2
  66. end
  67. end
  68.  
  69.  
  70.  
  71. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement