# I made this disaster because I dont want to write from scratch because I hate restarting systems, switching root, rebuilding initramfs and hope that it works every single time. # If you want to edit theme just change png files with yours, and change image count in line 24 Window.SetBackgroundTopColor (0, 0, 0); Window.SetBackgroundBottomColor (0, 0, 0); for(i = 1; i <= 120; i++) { image[i].image = Image("image-" + i + ".png"); image[i].sprite = Sprite(image[i].image); image[i].sprite.SetOpacity(0); image[i].x = Window.GetX() + Window.GetWidth() / 2 - image[i].image.GetWidth() / 2; image[i].y = Window.GetY() + Window.GetHeight() / 2 - image[i].image.GetHeight() / 2; image[i].sprite.SetPosition(image[i].x, image[i].y, 0); } index = 1; fun boot_callback() { if(index >= 120 + 1) { index = 1; } else { for(i = 1; i <= 120; i++) { if(index != i) { image[i].sprite.SetOpacity(0); } else { image[i].sprite.SetOpacity(1); } } index++; } } #Compability variable status = "normal"; status_message = []; fun dialog_setup() { local.box; local.lock; local.entry; box.image = Image("box.png"); lock.image = Image("lock.png"); entry.image = Image("entry.png"); box.sprite = Sprite(box.image); box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2; box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2 + 212; box.z = 10000; box.sprite.SetPosition(box.x, box.y, box.z); lock.sprite = Sprite(lock.image); lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2; lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2 + 212; lock.z = box.z + 1; lock.sprite.SetPosition(lock.x, lock.y, lock.z); entry.sprite = Sprite(entry.image); entry.x = lock.x + lock.image.GetWidth(); entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2 + 212; entry.z = box.z + 1; entry.sprite.SetPosition(entry.x, entry.y, entry.z); global.dialog.box = box; global.dialog.lock = lock; global.dialog.entry = entry; global.dialog.bullet_image = Image("bullet.png"); dialog_opacity (1); } fun dialog_opacity(opacity) { dialog.box.sprite.SetOpacity (opacity); dialog.lock.sprite.SetOpacity (opacity); dialog.entry.sprite.SetOpacity (opacity); for (index = 0; dialog.bullet[index]; index++) { dialog.bullet[index].sprite.SetOpacity(opacity); } } fun display_normal_callback () { global.status = "normal"; if (global.dialog) dialog_opacity (0); } fun display_password_callback (prompt, bullets) { global.status = "password"; if (!global.dialog) dialog_setup(); else dialog_opacity(1); for (index = 0; dialog.bullet[index] || index < bullets; index++) { if (!dialog.bullet[index]) { dialog.bullet[index].sprite = Sprite(dialog.bullet_image); dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth(); dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2; dialog.bullet[index].z = dialog.entry.z + 1; dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y + 50, dialog.bullet[index].z); } if (index < bullets) dialog.bullet[index].sprite.SetOpacity(1); else dialog.bullet[index].sprite.SetOpacity(0); } } Plymouth.SetDisplayNormalFunction(display_normal_callback); Plymouth.SetDisplayPasswordFunction(display_password_callback); #----------------------------------------- Progress Bar -------------------------------- progress_box.image = Image("progress_box.png"); progress_box.sprite = Sprite(progress_box.image); progress_box.x = Window.GetX() + Window.GetWidth() / 2 - progress_box.image.GetWidth() / 2; progress_box.y = Window.GetY() + Window.GetHeight() * 0.75 - progress_box.image.GetHeight() / 2; progress_box.sprite.SetPosition(progress_box.x, progress_box.y, 0); progress_bar.original_image = Image("progress_bar.png"); progress_bar.sprite = Sprite(); progress_bar.x = Window.GetX() + Window.GetWidth() / 2 - progress_bar.original_image.GetWidth() / 2; progress_bar.y = Window.GetY() + Window.GetHeight() / 2 * 1.5 - progress_box.image.GetHeight() / 2 + (progress_box.image.GetHeight() - progress_bar.original_image.GetHeight()) / 2; progress_bar.sprite.SetPosition(progress_bar.x, progress_bar.y, 1); #its not fun ok? :D fun progress_callback (duration, progress) { if (progress_bar.image.GetWidth () != Math.Int (progress_bar.original_image.GetWidth () * progress)) { progress_bar.image = progress_bar.original_image.Scale(progress_bar.original_image.GetWidth(progress_bar.original_image) * progress, progress_bar.original_image.GetHeight()); progress_bar.sprite.SetImage (progress_bar.image); } } fun create_text_color(text, x, y, r, g, b) { t.image = Image.Text(text, r, g, b, 1, global.font); s.image = Image.Text(text, r/4, g/4, b/4, 1, global.font); y *= (Window.GetHeight() - t.image.GetHeight()); x *= (Window.GetWidth() - t.image.GetWidth()); t.sprite = Sprite(t.image); s.sprite = Sprite(s.image); t.sprite.SetPosition(x, y + 212, 2); # Plus here is intentional s.sprite.SetPosition(x + global.scale, y + global.scale + 212, 1); t.sprite.SetOpacity(1); s.sprite.SetOpacity(1); return [t, s, text]; } fun text_height_adj() { return text_height(global.textblank) / Window.GetHeight(); } fun create_text(text, x, y) { return create_text_color(text, x, y, 1, 1, 1); } # Compability variables scale_width = Math.Int(Window.GetWidth() / 640); scale_height = Math.Int(Window.GetHeight() / 480); scale = Math.Max(scale_width, scale_height, 1); scale = Math.Int(Math.Min(6, scale)); font = "monospace" + 6.8*3; textblank = create_text(" ", 0, 0); # Compability function. fun text_height(text) { return text[0].image.GetHeight(); } fun change_position_abs(thing, x, y) { thing[0].sprite.SetPosition(x, y, 2); thing[1].sprite.SetPosition(x+global.scale, y+global.scale, 1); } fun delete_text(text) { text[0].sprite.SetOpacity(0); text[1].sprite.SetOpacity(0); } messages = []; message_latest = 0; fun display_message_callback(text) { messages[message_latest] = create_text(text, 0, 1); height = Window.GetHeight() - text_height(messages[0]); for(i = message_latest - 1; i >= 0; i--) { if(messages[i] == NULL) continue; height -= text_height(messages[i+1]); change_position_abs(messages[i], 0, height); } message_latest++; } fun hide_message_callback(text) { for(i = 0; i < message_latest; i++) { if(messages[i][2] == text) { delete_text(text); messages[i] = NULL; } } } message = "This animation has bugged!"; if(Plymouth.GetMode() == "boot") message = "Booting OS"; else if(Plymouth.GetMode() == "updates") message = "Updating"; else if(Plymouth.GetMode() == "system-upgrade") message = "Upgrading system"; else if(Plymouth.GetMode() == "firmware-upgrade") { message = "Upgrading system firmware"; warning = create_text_color("DO NOT POWER OFF SYSTEM!", 0.5, 0.5+text_height_adj(), 1, 0, 0); } else if(Plymouth.GetMode() == "system-reset") { message = "Resetting system"; } text = create_text(message, 0.5, 0.5 - text_height_adj()); fun update_status_callback(text) { delete_text(global.status_message); global.status_message = create_text(text, 0.5, 0.5 + 2.5*text_height_adj()); } Plymouth.SetDisplayMessageFunction(display_message_callback); Plymouth.SetHideMessageFunction(hide_message_callback); Plymouth.SetUpdateStatusFunction(update_status_callback); Plymouth.SetBootProgressFunction(progress_callback); Plymouth.SetRefreshFunction(boot_callback); Plymouth.SetQuitFunction(boot_callback); if (Plymouth.GetMode() == "shutdown") { text = create_text("Saving files and shutting down", 0.5, 0.5 + text_height_adj()); } if (Plymouth.GetMode() == "reboot") { text = create_text("Restarting", 0.5, 0.5 + text_height_adj()); } # Only shown if you somehow break this if (Plymouth.GetMode() == "unknown") { text = create_text("Weeeeeeeeeeeeeee", 0.5, 0.5 + text_height_adj()); }