Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Define the title and APIs
- local title = "Starting CameronOS..."
- local apis = {
- "Loading API: rednet",
- "Loading API: orangeFS",
- "Loading API: quarrysound",
- "Loading API: sunUI"
- }
- -- Get terminal size and calculate the middle of the screen
- local w, h = term.getSize()
- local wm, hm = w / 2, h / 2
- -- Function to display the title with animation and the APIs below it
- parallel.waitForAny(function()
- -- Flashing Title Animation
- for _ = 1, 2 do
- term.setBackgroundColor(colors.red)
- term.setTextColor(colors.gray)
- term.setCursorPos(wm - (#title / 2), hm)
- term.clear()
- term.write(title)
- sleep(0.2)
- term.setBackgroundColor(colors.green)
- term.setTextColor(colors.lightGray)
- term.setCursorPos(wm - (#title / 2), hm)
- term.clear()
- term.write(title)
- sleep(0.2)
- term.setBackgroundColor(colors.cyan)
- term.setTextColor(colors.white)
- term.setCursorPos(wm - (#title / 2), hm)
- term.clear()
- term.write(title)
- sleep(0.2)
- end
- -- Set the background and text colors
- term.setBackgroundColor(colors.cyan)
- term.setTextColor(colors.white)
- term.setCursorPos(wm - (#title / 2), hm)
- term.clear()
- term.write(title)
- sleep(1)
- -- Start loading APIs beneath the title
- local apiStartY = hm + 2 -- Start two lines below the title
- for i, api in ipairs(apis) do
- -- Calculate the X position for the API to align it under the title
- local apiX = wm - (#api / 2)
- -- Flashing Effect for APIs
- for _ = 1, 2 do
- term.setBackgroundColor(colors.cyan)
- term.setTextColor(colors.lightGray)
- term.setCursorPos(apiX, apiStartY + i - 1) -- Position each API under the title
- term.clearLine()
- term.write(api)
- sleep(0.025)
- term.setBackgroundColor(colors.cyan)
- term.setTextColor(colors.gray)
- term.setCursorPos(apiX, apiStartY + i - 1)
- term.clearLine()
- term.write(api)
- sleep(0.025)
- end
- end
- end)
- sleep(2)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.clear()
- -- Optional: You can add more actions here after the animation
- -- Transition to terminal or other actions
- term.setTextColor(colors.white)
- term.setCursorPos(1, 1)
Advertisement
Add Comment
Please, Sign In to add comment