Advertisement
DOGGYWOOF

Untitled

Nov 21st, 2024 (edited)
4
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. -- Transition Effect with CRT Scanlines
  2. local function transitionToCRT(colorSequence, delay)
  3. local _, height = term.getSize() -- Get terminal width and height
  4.  
  5. for _, color in ipairs(colorSequence) do
  6. term.setBackgroundColor(color)
  7. term.clear()
  8.  
  9. -- Simulating CRT scanlines (by alternating row colors)
  10. for y = 1, height do
  11. term.setCursorPos(1, y)
  12. if y % 2 == 0 then
  13. -- Dark row for scanline effect
  14. term.write(" ")
  15. else
  16. -- Normal row
  17. term.write(" ")
  18. end
  19. end
  20.  
  21. sleep(delay)
  22. end
  23. end
  24.  
  25. -- Intro Transition: Fade to Black with CRT Effect
  26. local function introTransition()
  27. local colorsToFade = {
  28. colors.white, colors.lightGray, colors.gray, colors.black
  29. }
  30. transitionToCRT(colorsToFade, 0.1)
  31. end
  32.  
  33. -- Outro Transition: Fade to White with CRT Effect
  34. local function outroTransition()
  35. local colorsToFade = {
  36. colors.black, colors.gray, colors.lightGray, colors.white
  37. }
  38. transitionToCRT(colorsToFade, 0.1)
  39. end
  40.  
  41. -- Main Program
  42. introTransition() -- Smooth transition to blank screen with CRT effect
  43. os.pullEvent("key") -- Wait for any key press
  44. outroTransition() -- Smooth transition to white with CRT effect
  45. sleep(0.1) -- Wait an additional 0.1 seconds after the outro transition
  46. shell.run("/disk/os/lock") -- Run the lock program
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement