Advertisement
Guest User

sine

a guest
Apr 11th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.95 KB | None | 0 0
  1. local scr_x, scr_y = term.getSize()
  2.        
  3. local doit = function(move)
  4.   if not move then move = 0 end
  5.   local res1,res2
  6.   for a = 1, scr_y do
  7.     for b = 1, scr_x do
  8.       local x = b+math.floor(scr_x/2)
  9.       local y = a-math.ceil(scr_y/2)
  10.       res1 = math.abs( math.floor(math.sin((x/7)+move)*6) - y ) <= 2
  11.       term.setCursorPos(b,a)
  12.       if res1 then
  13.         term.blit(" ","7","7")
  14.       else
  15.         term.write(" ")
  16.       end
  17.       res2 = math.abs( math.floor(math.cos((x/4)+(move*4))*3) - y+2 ) <= 1
  18.       term.setCursorPos(b,a)
  19.       if res2 then
  20.         term.blit(" ","8","8")
  21.       else
  22.         if not res1 then
  23.           if (x % 2 == 0) and ((y+math.floor(move*-10)+(x % 5)) % 5 <= 1) then
  24.             term.blit("|","7","f")
  25.           else
  26.             term.write(" ")
  27.           end
  28.         end
  29.       end
  30.     end
  31.   end
  32. end
  33.  
  34. while true do
  35.   for a = 1, 900 do
  36.     --term.clear()
  37.     doit(a/10)
  38.     sleep(0.05)
  39.   end
  40. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement