rathleif

derpcclock

Dec 15th, 2013
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. local w,h = term.getSize()
  2. local ttfl = (os.time()/24) * 2 * math.pi
  3. local day = ttfl/8
  4. function printFrame()
  5. for i=0,math.pi*2,math.pi/128 do
  6. local xco = math.cos(i) * w/2 + w/2 + 1
  7. local yco = math.sin(i) * h/2 + h/2 + 1
  8.  
  9. term.setCursorPos(xco,yco)
  10. term.write("*")
  11. end
  12. end
  13. function printHands()
  14. local ttf = (os.time()/24) * math.pi * 2
  15. local inc = ttf - ttfl
  16. if ttf < ttfl then inc = 1 + ttf - ttfl end
  17.  
  18. day = day + inc/8
  19. day = day % (math.pi * 2)
  20.  
  21. ttfl = ttf
  22.  
  23. for i=0,0.9,0.05 do
  24. local xco = math.cos(ttf-math.pi/2) * w/2 * i + w/2 + 1
  25. local yco = math.sin(ttf-math.pi/2) * h/2 * i + h/2 + 1
  26.  
  27. term.setCursorPos(xco,yco)
  28. term.write("&")
  29. end
  30.  
  31. for i=0,0.5,0.05 do
  32. local xco = math.cos(day-math.pi/2) * w/2 * i + w/2 + 1
  33. local yco = math.sin(day-math.pi/2) * h/2 * i + h/2 + 1
  34.  
  35. term.setCursorPos(xco,yco)
  36. term.write("#")
  37. end
  38. end
  39. while true do
  40. term.clear()
  41. printFrame()
  42. printHands()
  43.  
  44. sleep(1)
  45. end
Add Comment
Please, Sign In to add comment