Advertisement
King0fGamesYami

Pulse

Aug 27th, 2015
876
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.00 KB | None | 0 0
  1. local chartbl = {"*","%","@"}
  2. local colortbl = {colors.blue, colors.lightBlue, colors.cyan, colors.green, colors.lime, colors.yellow, colors.pink, colors.magenta, colors.purple}
  3.  
  4. local curCol, incCol, reverse, maxx, maxy = 1, 1, false, term.getSize()
  5.  
  6. local function advClear( c, b, t )
  7.     term.setBackgroundColor( b )
  8.     term.setTextColor( t )
  9.     for y = 1, maxy do
  10.         term.setCursorPos( 1, y )
  11.         term.write( c:rep( maxx ) )
  12.     end
  13. end
  14.  
  15. while true do
  16.     for theChar = (reverse and #chartbl or 1), (reverse and 1 or #chartbl), (reverse and -1 or 1) do
  17.         advClear( chartbl[ theChar ], colortbl[ curCol ], colortbl[ curCol + (reverse and -1 or 1) ] )
  18.         sleep( 0.05 )
  19.     end
  20.     for theChar = (reverse and 1 or #chartbl), (reverse and #chartbl or 1), (reverse and 1 or -1 ) do
  21.         advClear( chartbl[ theChar ], colortbl[ curCol + (reverse and -1 or 1) ], colortbl[ curCol ]  )
  22.         sleep( 0.05 )
  23.     end
  24.     curCol = curCol + (reverse and -1 or 1)
  25.     if curCol == 1 or curCol == #colortbl then
  26.         reverse = not reverse
  27.     end
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement