SHARE
TWEET

startup

a guest Nov 15th, 2019 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. local pi = 3.1415
  3. -- stundenzeiger, 3 punkte und rotation.
  4. szp1x = nil
  5. szp2y = nil
  6. szp2x = nil
  7. szp2y = nil
  8. szp3x = nil
  9. szp3y = nil
  10. szrot = nil
  11. -- minutenzeiger, 3 punkte und rotation.
  12. mzp1x = nil
  13. mzp1y = nil
  14. mzp2x = nil
  15. mzp2y = nil
  16. mzp3x = nil
  17. mzp3y = nil
  18. mzrot = nil
  19. -- groessen umrechnungsfaktor x,y
  20. svx = nil
  21. svy = nil
  22. -- setup screen
  23. monitor = peripheral.wrap("right")
  24. term.redirect(monitor)
  25. monitor.setBackgroundColor(1)
  26. monitor.setTextColor(1)
  27. monitor.setTextScale(0.5)
  28. term.clear()
  29. -- berechne umrechnungs faktoren
  30. sx,sy = term.getSize()
  31. svx = sx/101
  32. svy = sy/101
  33. --print(svx," ",svy)
  34.  
  35. -- get Time
  36. while true do
  37.  
  38. t = os.time()
  39.  
  40. -- zeichne zifferblatt
  41. monitor.setBackgroundColor(1)
  42. monitor.clear()
  43. paintutils.drawBox((48.5*svx),(1.5*svy),(54.5*svx),(15.5*svy),32768)
  44. paintutils.drawBox((1.5*svx),(48.5*svy),(15.5*svx),(54.5*svy),32768)
  45. paintutils.drawBox((48.5*svx),(86.5*svy),(54.5*svx),(101.5*svy),32768)
  46. paintutils.drawBox((86.5*svx),(48.5*svy),(101.5*svx),(54.5*svy),32768)
  47.  
  48. --stunde in rad
  49. s = (2*pi)/12
  50. p = 0
  51. l = 51.5
  52.  
  53.    
  54.  for i = 1,12 do
  55.  p = p + s
  56.   if i == 3 or i == 6 or i == 9 or i == 12 then
  57.   else
  58.  p1x = svx*(51.5+math.sin(p)*l)
  59.  p1y = svy*(51.5+math.cos(p)*l)
  60.  p2x = svx*(51.5+math.sin(p)*(l-13))
  61.  p2y = svy*(51.5+math.cos(p)*(l-13))
  62.  --print(p1x," ",p1y," ",p2x," ",p2y)
  63.  paintutils.drawLine(p1x,p1y,p2x,p2y,32768)
  64.  end
  65.  end
  66.  
  67. -- zeichne zeiger
  68.  
  69. szrot = (2*pi*t)/12
  70. mzrot = 2*pi*t
  71. szl = 37
  72. mzl = 45
  73.  
  74. szp1x = svx*(51.5+math.sin(szrot)*szl)
  75. szp1y = svy*(51.5-math.cos(szrot)*szl)
  76. szp2x = svx*(51.5+math.sin(szrot+0.14)*szl*0.8)
  77. szp2y = svy*(51.5-math.cos(szrot+0.14)*szl*0.8)
  78. szp3x = svx*(51.5+math.sin(szrot-0.14)*szl*0.8)
  79. szp3y = svy*(51.5-math.cos(szrot-0.14)*szl*0.8)
  80.  
  81. mx = 51.5*svx
  82. my = 51.5*svy
  83.  
  84. paintutils.drawLine(mx,my,szp2x,szp2y,32768)
  85. paintutils.drawLine(szp2x,szp2y,szp1x,szp1y,32768)
  86. paintutils.drawLine(szp1x,szp1y,szp3x,szp3y,32768)
  87. paintutils.drawLine(szp3x,szp3y,mx,my,32768)
  88.  
  89. mzp1x = svx*(51.5+math.sin(mzrot)*mzl)
  90. mzp1y = svy*(51.5-math.cos(mzrot)*mzl)
  91. mzp2x = svx*(51.5+math.sin(mzrot+0.1)*mzl*0.7)
  92. mzp2y = svy*(51.5-math.cos(mzrot+0.1)*mzl*0.7)
  93. mzp3x = svx*(51.5+math.sin(mzrot-0.1)*mzl*0.7)
  94. mzp3y = svy*(51.5-math.cos(mzrot-0.1)*mzl*0.7)
  95.  
  96. paintutils.drawLine(mx,my,mzp2x,mzp2y,32768)
  97. paintutils.drawLine(mzp2x,mzp2y,mzp1x,mzp1y,32768)
  98. paintutils.drawLine(mzp1x,mzp1y,mzp3x,mzp3y,32768)
  99. paintutils.drawLine(mzp3x,mzp3y,mx,my,32768)
  100.  
  101. sleep(0.2)
  102. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top