Advertisement
nonogamer9

teest

Nov 12th, 2024 (edited)
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. -- Custom Bit Library
  2. local Bit = {}
  3.  
  4. function Bit.and(a, b)
  5. return a * b
  6. end
  7.  
  8. function Bit.or(a, b)
  9. return a + b - (Bit.and(a, b))
  10. end
  11.  
  12. function Bit.xor(a, b)
  13. return (a + b) - (2 * Bit.and(a, b))
  14. end
  15.  
  16. function Bit.not(a)
  17. return 1 - a
  18. end
  19.  
  20. function Bit.lshift(a, n)
  21. return a * (2 ^ n)
  22. end
  23.  
  24. function Bit.rshift(a, n)
  25. return math.floor(a / (2 ^ n))
  26. end
  27.  
  28. -- Function to create a plasma sinusoid effect
  29. function plasmaSinusoid(width, height, time)
  30. local pixels = {}
  31.  
  32. for y = 1, height do
  33. pixels[y] = {}
  34. for x = 1, width do
  35. -- Calculate the sinusoidal value
  36. local value = math.sin((x + time * 10) * 0.1) * 0.5 + 0.5
  37. -- Scale the value to a color range (0-15 for Minecraft)
  38. local color = math.floor(value * 15)
  39.  
  40. -- Set pixel color using custom bitwise operations if needed
  41. pixels[y][x] = color
  42. end
  43. end
  44.  
  45. -- Draw the pixels on the screen
  46. for y = 1, height do
  47. for x = 1, width do
  48. term.setCursorPos(x, y)
  49. term.setBackgroundColor(colors[pixels[y][x]])
  50. term.write(" ")
  51. end
  52. end
  53. end
  54.  
  55. -- Main loop to animate the plasma effect
  56. while true do
  57. local time = os.clock()
  58. plasmaSinusoid(50, 20, time)
  59. sleep(0.05) -- Adjust speed of animation
  60. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement