Advertisement
LDDestroier

Lua Youtube Channel Intro

Jun 27th, 2015
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. scr_x, scr_y = term.getSize()
  2. midPoint = {
  3.     scr_x / 2,
  4.     scr_y / 2,
  5. }
  6.  
  7. message = {
  8.     "EldidiStroyrr",
  9. }
  10.  
  11. spinSpeed = 1
  12. spinPoint = 1
  13. spinner = {
  14.     "|",
  15.     "/",
  16.     "-",
  17.     "\\",
  18. }
  19.  
  20. normalColor = colors.white
  21. normalTextColor = colors.black
  22.  
  23. function writeMessages(quick)
  24.     if not quick then
  25.         totalLength = math.floor(midPoint[1]-(#message[1]/2))
  26.         for a = 1, totalLength do
  27.             megaBackground(math.floor((a/totalLength)*(midPoint[2]-1)))
  28.             for c = 1, spinSpeed do
  29.                 spinPoint = spinPoint + 1
  30.                 if spinPoint > #spinner then
  31.                     spinPoint = 1
  32.                 end
  33.                 term.setCursorPos(a,math.floor(midPoint[2]-(#message/2))+1)
  34.                 term.setTextColor(normalTextColor)
  35.                 term.setBackgroundColor(normalColor)
  36.                 term.clearLine()
  37.                 write(spinner[spinPoint])
  38.                 sleep(0)
  39.             end
  40.         end
  41.     end
  42.     totalLength = 0
  43.     progress = 0
  44.     for a = 1, #message do
  45.         totalLength = totalLength + #message[a]
  46.     end
  47.     for a = 1, #message do
  48.         if not quick then
  49.             for b = 1, #message[a] do
  50.                 progress = progress + 1
  51. --              megaBackground(math.ceil((progress/totalLength)*(midPoint[2]-(#message/2)-1)))
  52.                 term.setBackgroundColor(normalColor)
  53.                 term.setTextColor(colors.orange)
  54.                 term.setCursorPos(midPoint[1]-(#message[a])/2,math.floor(midPoint[2]-(#message/2)+a))
  55.                 term.clearLine()
  56.                 write(string.sub(message[a], 1, b))
  57.                 term.setBackgroundColor(normalColor)
  58.                 term.setTextColor(normalTextColor)
  59.                 for c = 1, spinSpeed do
  60.                     spinPoint = spinPoint + 1
  61.                     if spinPoint > #spinner then
  62.                         spinPoint = 1
  63.                     end
  64.                     if b < #message[a] then
  65.                         term.setCursorPos((midPoint[1]-(string.len(message[a])/2))+b,math.floor(midPoint[2]-(#message/2)+a))
  66.                         write(spinner[spinPoint])
  67.                         sleep(0)
  68.                     end
  69.                 end
  70.             end
  71.             sleep(0.03)
  72.         else
  73.             term.setCursorPos(midPoint[1]-(string.len(message[a])/2),math.floor(midPoint[2]-(#message/2)+a))
  74.             term.setTextColor(colors.orange)
  75.             term.setBackgroundColor(normalColor)
  76.             term.clearLine()
  77.             write(message[a])
  78.         end
  79.     end
  80. end
  81.  
  82. function megaBackground(depth)
  83.     for b = 1, math.ceil(depth) do
  84.         term.setCursorPos(1,math.ceil(b))
  85.         if b == math.ceil(depth) then
  86.             term.setBackgroundColor(colors.black)
  87.         else
  88.             term.setBackgroundColor(colors.blue)
  89.         end
  90.         term.clearLine()
  91.     end
  92.     for b = 1, math.floor(depth) do
  93.         term.setCursorPos(1,math.floor(scr_y-(b-1)))
  94.         if b == math.floor(depth) then
  95.             term.setBackgroundColor(colors.black)
  96.         else
  97.             term.setBackgroundColor(colors.blue)
  98.         end
  99.         term.clearLine()
  100.     end
  101. end
  102.  
  103. function flashScreen(flashes)
  104.     for a = 1, flashes do
  105.         term.setBackgroundColor(colors.white)
  106.         term.clear()
  107.         sleep(0.1)
  108.         term.setBackgroundColor(colors.black)
  109.         term.clear()
  110.         sleep(0.1)
  111.     end
  112.     return true
  113. end
  114.  
  115. function closeMegaBackground(depth)
  116.     for a = 1, depth do
  117.         megaBackground(a)
  118.         sleep(0.1)
  119.     end
  120. end
  121.  
  122. function display()
  123.     flashScreen(2)
  124.     term.setBackgroundColor(colors.white)
  125.     term.clear()
  126.     writeMessages(false)
  127. end
  128.  
  129. display()
  130.  
  131. sleep(5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement