summaryrefslogtreecommitdiff
path: root/lines-theme
diff options
context:
space:
mode:
authorAurélien COUDERC <zecoucou@free.fr>2017-01-15 10:23:43 +0000
committerAurélien COUDERC <zecoucou@free.fr>2017-01-15 10:23:43 +0000
commit3cf981ecb1eb51e322287aa3eb0969b64d8fa4a9 (patch)
tree19d0f69359190ac65897dd3684a61fe7ea6c5b76 /lines-theme
parentf5e890d42e307fe338c155ea8bf55cea40fc7a94 (diff)
Plymouth/lines: fix alignment of fsckd ctrl-c message
Diffstat (limited to 'lines-theme')
-rw-r--r--lines-theme/plymouth/lines.script329
1 files changed, 163 insertions, 166 deletions
diff --git a/lines-theme/plymouth/lines.script b/lines-theme/plymouth/lines.script
index ee0a110..8580441 100644
--- a/lines-theme/plymouth/lines.script
+++ b/lines-theme/plymouth/lines.script
@@ -1,4 +1,4 @@
-# ubuntu-logo.script - boot splash plugin
+# lines.script - boot splash using script plugin
#
# Copyright (C) 2009 Canonical Ltd.
#
@@ -30,12 +30,15 @@ ELECTRONS_DISPLAYED = 3;
SECS_BETWEEN_ANIMS = 2.5;
#------------------------------- Globals -------------------------------------------
+# are we currently prompting for a password?
+prompt_active = 0;
+
anim_iter = 0;
anim_status = "stopped";
-bg_image = Image("background.png");
#------------------------------- Background ----------------------------------------
+bg_image = Image("background.png");
# Compute screen/image ratio and scale the background accordingly
window_max_width = Window.GetX() * 2 + Window.GetWidth();
window_max_height = Window.GetY() * 2 + Window.GetHeight();
@@ -84,8 +87,8 @@ debian_sprite.SetPosition(Window.GetX() + Window.GetWidth() / 2 - debian_image.G
electron_image = Image("electron.png");
electron_image = electron_image.Scale(
- electron_image.GetWidth() * 0.06 * logo_scale_factor,
- electron_image.GetHeight() * 0.06 * logo_scale_factor);
+ electron_image.GetWidth() * 0.06 * logo_scale_factor,
+ electron_image.GetHeight() * 0.06 * logo_scale_factor);
#main center coords
@@ -129,20 +132,20 @@ ellipses[2].anim.rotat_dir = 1;
# Define 5 sprites for each electron to create gradient along the ellipses
for (i = 0; i < ELECTRONS_DISPLAYED; i++) {
- anim = ellipses[i].anim;
- anim.angle_incr = anim.arc / (anim.stop_iter - anim.start_iter) * anim.rotat_dir;
- for (j = 0; j < 5; j++) {
- electron_sprite[i][j] = Sprite(electron_image);
- electron_sprite[i][j].SetOpacity(0);
- electron_sprite[i][j].base_opacity = 1-(0.2*j);
- electron_sprite[i][j].angle_diff = -(anim.rotat_dir*j*0.01);
- }
+ anim = ellipses[i].anim;
+ anim.angle_incr = anim.arc / (anim.stop_iter - anim.start_iter) * anim.rotat_dir;
+ for (j = 0; j < 5; j++) {
+ electron_sprite[i][j] = Sprite(electron_image);
+ electron_sprite[i][j].SetOpacity(0);
+ electron_sprite[i][j].base_opacity = 1-(0.2*j);
+ electron_sprite[i][j].angle_diff = -(anim.rotat_dir*j*0.01);
+ }
}
# Set the text colour in (rgb / 256)
text_colour.red = 1.0;
-text_colour.green = 1.0;
+text_colour.green = 1.0;
text_colour.blue = 1.0;
# Tinted text #988592
@@ -158,10 +161,9 @@ action_text_colour.blue = 1.0;
# Orange - #ff4012 - RGB 255 64 18
debugsprite = Sprite();
debugsprite_bottom = Sprite();
+debugsprite_bottom.SetPosition(0, (Window.GetHeight (0) - 20), 1);
debugsprite_medium = Sprite();
-
-# are we currently prompting for a password?
-prompt_active = 0;
+debugsprite_medium.SetPosition(0, (Window.GetHeight (0) - 100), 1);
# General purpose function to create text
fun WriteText (text, colour) {
@@ -169,33 +171,31 @@ fun WriteText (text, colour) {
return image;
}
-fun ImageToText (text) {
+fun ImageFromText (text) {
image = WriteText (text, text_colour);
return image;
}
-fun ImageToTintedText (text) {
+fun ImageFromTintedText (text) {
image = WriteText (text, tinted_text_colour);
return image;
}
-fun ImageToActionText (text) {
+fun ImageFromActionText (text) {
image = WriteText (text, action_text_colour);
return image;
}
fun Debug(text) {
- debugsprite.SetImage(ImageToText (text));
+ debugsprite.SetImage(ImageFromText (text));
}
fun DebugBottom(text) {
- debugsprite_bottom.SetImage(ImageToText (text));
- debugsprite_bottom.SetPosition(0, (Window.GetHeight (0) - 20), 1);
+ debugsprite_bottom.SetImage(ImageFromText (text));
}
fun DebugMedium(text) {
- debugsprite_medium.SetImage(ImageToText (text));
- debugsprite_medium.SetPosition(0, (Window.GetHeight (0) - 100), 1);
+ debugsprite_medium.SetImage(ImageFromText (text));
}
fun TextYOffset() {
@@ -205,7 +205,7 @@ fun TextYOffset() {
# Put the 1st line below the logo + some spacing
y = logo_sprite.GetY() + logo_image.GetHeight();
- #Debug("y = " + y);
+ #Debug("y = " + y);
text_height = first_line_height * 7.5;
@@ -233,7 +233,7 @@ fun StringString(string, substring) {
}
start++;
}
-
+
return NULL;
}
@@ -248,7 +248,7 @@ fun StringCopy (source, beginning, end) {
for (index = beginning; ( ( (end == NULL) || (index <= end) ) && (String(source).CharAt(index)) ); index++) {
local.destination += String(source).CharAt(index);
}
-
+
return local.destination;
}
@@ -302,16 +302,16 @@ bits_per_pixel = Window.GetBitsPerPixel ();
password_field_filename = "password_field.png";
#}
-message_notification[0].image = ImageToTintedText ("");
-message_notification[1].image = ImageToTintedText ("");
-fsck_notification.image = ImageToActionText ("");
+message_notification[0].image = ImageFromTintedText ("");
+message_notification[1].image = ImageFromTintedText ("");
+fsck_notification.image = ImageFromActionText ("");
status = "normal";
# use a fixed string with ascending and descending stems to calibrate the
# bounding box for the first message, so the messages below don't move up
# and down according to *their* height.
-first_line_height = ImageToTintedText ("AfpqtM").GetHeight();
+first_line_height = ImageFromTintedText ("AfpqtM").GetHeight();
# if the user has a 640x480 or 800x600 display, we can't quite fit everything
# (including passphrase prompts) with the target spacing, so scoot the text up
@@ -333,13 +333,13 @@ fun draw_logo () {
#-----------------------------------------Progress Indicator--------------------------
# Implement in boot progress callback
fun animate_progress_indicator (time, progress) {
- # Start electrons animation at launch and every 3 seconds
+ # Start electrons animation at launch and every 3 seconds
if (global.progress_time == NULL || (time - global.progress_time) >= SECS_BETWEEN_ANIMS) {
global.progress_time = time;
- global.anim_status = "start";
- }
+ global.anim_status = "start";
+ }
- # Debug ("global progress time =" + global.progress_time + " global anim status = " + global.anim_status + " progress = " + progress + ", time = " + time);
+ #Debug ("global progress time =" + global.progress_time + " global anim status = " + global.anim_status + " progress = " + progress + ", time = " + time);
}
@@ -351,16 +351,16 @@ fun animate_progress_indicator (time, progress) {
# message_label array
#
fun get_message_label (label, is_fake, is_action_line) {
- # Debug("Get Label position");
+ #Debug("Get Label position");
local.message_label;
-
+
if (is_fake)
# Create a fake label so as to get the y coordinate of
# a standard-length label.
- local.message_image = ImageToTintedText ("This is a fake message");
+ local.message_image = ImageFromTintedText ("This is a fake message");
else
- local.message_image = (is_action_line) && ImageToActionText (label) || ImageToTintedText (label);
-
+ local.message_image = (is_action_line) && ImageFromActionText (label) || ImageFromTintedText (label);
+
message_label.width = message_image.GetWidth ();
message_label.height = message_image.GetHeight ();
@@ -375,13 +375,13 @@ fun get_message_label (label, is_fake, is_action_line) {
message_label.y = local.fsck_label.y + (first_line_height * 2);
}
- # Debug("action label x = " + message_label.x + " y = " + message_label.y );
+ #Debug("action label x = " + message_label.x + " y = " + message_label.y );
# message_debug = "msg_x = " + message_label.x + " msg_y = " + message_label.y +
# "msg_width = " + message_label.width + " msg_height = " +
# message_label.height + " message = " + label;
# Debug(message_debug);
-
+
return message_label;
}
@@ -390,28 +390,28 @@ fun get_message_label (label, is_fake, is_action_line) {
fun get_fsck_label (label, is_fake) {
# Debug("Get Label position");
local.fsck_label = global.progress_label;
-
+
if (is_fake)
- fsck_label.image = ImageToTintedText ("This is a fake message");
+ fsck_label.image = ImageFromTintedText ("This is a fake message");
else
- fsck_label.image = ImageToTintedText (label);
-
+ fsck_label.image = ImageFromTintedText (label);
+
fsck_label.width = fsck_label.image.GetWidth ();
fsck_label.height = fsck_label.image.GetHeight ();
-
+
# Centre the label horizontally
fsck_label.x = Window.GetX () + Window.GetWidth () / 2 - fsck_label.width / 2;
-
+
local.first_label = get_message_label (label, 1, 0);
-
+
# Place the label below the 1st message line
fsck_label.y = local.first_label.y + local.first_label.height + (local.first_label.height / 2);
-
+
# message_debug = "msg_x = " + fsck_label.x + " msg_y = " + fsck_label.y +
# "msg_width = " + fsck_label.width + " msg_height = " +
# fsck_label.height + " message = " + label;
# Debug(message_debug);
-
+
return fsck_label;
}
@@ -423,14 +423,14 @@ fun get_fsck_label (label, is_fake) {
# NOTE: this is called when doing something like 'plymouth message "hello world"'
#
fun setup_message (message_text, x, y, z, index) {
- # Debug("Message setup");
- global.message_notification[index].image = (index) && ImageToActionText (message_text) || ImageToTintedText (message_text);
+ #DebugMedium("Message setup: " + message_text);
+ global.message_notification[index].image = (index) && ImageFromActionText (message_text) || ImageFromTintedText (message_text);
# Set up the text message, if any
message_notification[index].x = x;
message_notification[index].y = y;
message_notification[index].z = z;
-
+
message_notification[index].sprite = Sprite ();
message_notification[index].sprite.SetImage (message_notification[index].image);
message_notification[index].sprite.SetX (message_notification[index].x);
@@ -457,12 +457,12 @@ fun message_callback (message)
# Debug("Message callback");
is_fake = 0;
if (!message || (message == "")) is_fake = 1;
-
+
local.substring = "keys:";
-
+
# Look for the "keys:" prefix
local.keys = StringString(message, local.substring);
-
+
local.is_action_line = (keys != NULL);
#Debug("keys " + local.keys + " substring length = " + StringLength(local.substring));
@@ -470,16 +470,16 @@ fun message_callback (message)
if (keys != NULL)
message = StringCopy (message, keys + StringLength(local.substring), NULL);
- local.label.is_fake = is_fake;
- label = get_message_label(message, is_fake, is_action_line);
- label.z = 10000;
-
# Get the message without the "fsckd-cancel-msg" prefix as we don't support i18n
substring = "fsckd-cancel-msg:";
keys = StringString(message, substring);
if (keys != NULL)
message = StringCopy(message, keys + StringLength(substring), NULL);
-
+
+ local.label.is_fake = is_fake;
+ label = get_message_label(message, is_fake, is_action_line);
+ label.z = 10000;
+
setup_message (message, label.x, label.y, label.z, is_action_line);
if (prompt_active && local.is_action_line)
hide_message (is_action_line);
@@ -493,36 +493,36 @@ fun message_callback (message)
#
fun password_dialogue_setup (message_label) {
- # Debug("Password dialog setup");
-
+ #Debug("Password dialog setup");
+
local.entry;
local.bullet_image;
-
+
bullet_image = Image (password_dot_filename);
entry.image = Image (password_field_filename);
-
+
# Hide the normal labels
prompt_active = 1;
if (message_notification[1].sprite) hide_message (1);
-
+
# Set the prompt label
label = get_message_label(message_label, 0, 1);
label.z = 10000;
-
+
setup_message (message_label, label.x, label.y, label.z, 2);
show_message (2);
# Set up the text entry which contains the bullets
entry.sprite = Sprite ();
entry.sprite.SetImage (entry.image);
-
+
# Centre the box horizontally
entry.x = Window.GetX () + Window.GetWidth () / 2 - entry.image.GetWidth () / 2;
# Put the entry below the second label.
entry.y = message_notification[2].y + label.height;
- # Debug ("entry x = " + entry.x + ", y = " + entry.y);
+ #DebugMedium("entry x = " + entry.x + ", y = " + entry.y);
entry.z = 10000;
entry.sprite.SetX (entry.x);
entry.sprite.SetY (entry.y);
@@ -532,7 +532,7 @@ fun password_dialogue_setup (message_label) {
}
fun password_dialogue_opacity (opacity) {
- # Debug("Password dialog opacity");
+ #Debug("Setting password dialog opacity to " + opacity);
global.password_dialogue.opacity = opacity;
local = global.password_dialogue;
@@ -540,7 +540,7 @@ fun password_dialogue_opacity (opacity) {
# entry.sprite.SetOpacity (0.3);
entry.sprite.SetOpacity (opacity);
label.sprite.SetOpacity (opacity);
-
+
if (bullets) {
for (index = 0; bullets[index]; index++) {
bullets[index].sprite.SetOpacity (opacity);
@@ -552,8 +552,8 @@ fun password_dialogue_opacity (opacity) {
# The callback function is called when the display should display a password dialogue.
# First arg is prompt string, the second is the number of bullets.
fun display_password_callback (prompt, bullets) {
- # Debug("Password dialog setup");
-
+ #Debug("Password dialog setup");
+
global.status = "password";
if (!global.password_dialogue) password_dialogue_setup(prompt);
password_dialogue_opacity (1);
@@ -563,10 +563,10 @@ fun display_password_callback (prompt, bullets) {
password_dialogue.bullet_image.GetHeight () / 2;
margin = bullet_width;
spaces = Math.Int( (password_dialogue.entry.image.GetWidth () - (margin * 2)) / (bullet_width / 2 ) );
- # Debug ("spaces = " + spaces + ", bullets = " + bullets);
+ #DebugMedium ("spaces = " + spaces + ", bullets = " + bullets);
bullets_area.width = margin + spaces * (bullet_width / 2);
bullets_area.x = Window.GetX () + Window.GetWidth () / 2 - bullets_area.width / 2;
- # DebugBottom ("pwd_entry x = " + password_dialogue.entry.x + ", bullets_area.x = " + bullets_area.x + ", bullets_area.width = " + bullets_area.width);
+ #DebugBottom ("pwd_entry x = " + password_dialogue.entry.x + ", bullets_area.x = " + bullets_area.x + ", bullets_area.width = " + bullets_area.width);
if (bullets > spaces)
bullets = spaces;
for (index = 0; password_dialogue.bullets[index] || index < bullets; index++){
@@ -639,7 +639,7 @@ fun clear_fsck_count () {
fun set_progress_label_opacity (opacity) {
# the label
progress_label.sprite.SetOpacity (opacity);
-
+
# Make the slot available again when hiding the bar
# So that another bar can take its place
if (opacity == 0) {
@@ -678,17 +678,17 @@ fun update_progress_label (progress) {
# This happens when only counter.total has changed.
if (progress != NULL) {
progress_label.progress = progress;
-
+
#Debug("device " + progress_label.device + " progress " + progress);
-
+
# If progress >= 100% hide the label and make it available again
if (progress >= 100) {
set_progress_label_opacity (0);
-
+
# See if we any other fsck check is complete
# and, if so, hide the progress bars and the labels
on_fsck_completed ();
-
+
return 0;
}
}
@@ -705,7 +705,7 @@ fun update_progress_label (progress) {
#progress_label.progress = progress;
progress_label.sprite = Sprite (progress_label.image);
-
+
# Set up the bar
progress_label.sprite.SetPosition(progress_label.x, progress_label.y, 1);
@@ -749,18 +749,18 @@ fun add_fsck_to_queue (device, progress) {
continue;
}
local.index = i;
-
+
# Set device and progress
global.fsck_queue[local.index].device = device;
global.fsck_queue[local.index].progress = progress;
-
+
# Increase the queue counter
global.fsck_queue.counter++;
-
+
# Update the max index of the array for iterations
if (local.index > global.fsck_queue.biggest_item)
global.fsck_queue.biggest_item = local.index;
-
+
#DebugMedium ("Adding " + device + " at " + local.index);
}
@@ -779,7 +779,7 @@ fun is_progress_label_available () {
fun on_queued_fsck_completed () {
if (!is_queue_empty ())
return;
-
+
# Hide the extra label, if any
#if (progress_bar.extra_label.sprite)
# progress_bar.extra_label.sprite.SetOpacity(0);
@@ -793,7 +793,7 @@ fun remove_fsck_from_queue (index) {
# Decrease the queue counter
global.fsck_queue.counter--;
-
+
# See if there are other processes in the queue
# if not, clear the extra_label
on_queued_fsck_completed ();
@@ -805,14 +805,14 @@ fun on_fsck_completed () {
if (!is_progress_label_available ())
return;
-
+
if (!is_queue_empty ())
return;
-
+
# Hide the progress label
if (progress_label.sprite)
progress_label.sprite.SetOpacity (0);
-
+
# Clear the queue
clear_queue ();
@@ -828,10 +828,10 @@ fun update_progress_in_queue (index, device, progress) {
on_queued_fsck_completed ();
return;
}
-
+
global.fsck_queue[index].device = device;
global.fsck_queue[index].progress = progress;
-
+
}
# TODO: Move it to some function
@@ -860,7 +860,7 @@ fun fsck_check (device, progress, status_string) {
return;
}
-
+
if (device_has_progress_label (device)) {
# Update the progress of the existing label
update_progress_label (progress);
@@ -871,11 +871,11 @@ fun fsck_check (device, progress, status_string) {
# See if the progress_label is available
if (progress_label.is_available) {
-
+
# local.my_string = "available index " + local.available_index + " progress_bar counter is " + progress_bar.counter;
# Debug(local.my_string);
-
-
+
+
# If the fsck check for the device was in the queue, then
# remove it from the queue
if (local.queue_device_index >= 0) {
@@ -885,18 +885,18 @@ fun fsck_check (device, progress, status_string) {
# Increase the fsck counter
increase_fsck_count ();
}
-
+
# local.my_string += local.message;
#Debug("setting new label for device " + device + " progress " + progress);
# Set up a new label for the check
init_progress_label (device, status_string);
update_progress_label (progress);
-
+
}
# If the progress_label is not available
else {
-
+
# If the fsck check for the device is already in the queue
# just update its progress in the queue
if (local.queue_device_index >= 0) {
@@ -913,10 +913,10 @@ fun fsck_check (device, progress, status_string) {
refresh_progress_label ();
}
-
+
}
}
-
+
# if (!is_queue_empty ()) {
# DebugBottom("Extra label for "+ device);
#}
@@ -943,10 +943,10 @@ fun fsck_check (device, progress, status_string) {
fun update_status_callback (status) {
# Debug(status);
if (!status) return;
-
+
string_it = 0;
update_strings[string_it] = "";
-
+
for (i=0; (String(status).CharAt(i) != ""); i++) {
local.temp_char = String(status).CharAt(i);
if (temp_char != ":")
@@ -954,21 +954,21 @@ fun update_status_callback (status) {
else
update_strings[++string_it] = "";
}
-
+
# my_string = update_strings[0] + " " + update_strings[1] + " " + update_strings[2];
# Debug(my_string);
# Let's assume that we're dealing with these strings fsck:sda1:40
if ((string_it >= 2) && (update_strings[0] == "fsck")) {
-
+
device = update_strings[1];
progress = update_strings[2];
status_string[0] = update_strings[3]; # "Checking disk %1$d of %2$d (%3$d %% complete)"
if (!status_string[0])
status_string[0] = "Checking disk %1$d of %2$d (%3$d %% complete)";
-
+
if ((device != "") && (progress != "")) {
progress = StringToInteger (progress);
-
+
# Make sure that the fsck_queue is initialised
if (!global.fsck_queue)
init_queue ();
@@ -979,11 +979,11 @@ fun update_status_callback (status) {
# if (!global.progress_bar.extra_label.sprite)
# create_extra_fsck_label ();
-
+
# Keep track of the fsck check
fsck_check (device, progress, status_string);
}
-
+
}
# systemd-fsckd pass fsckd:<number_devices>:<progress>:<l10n_string>
@@ -1030,33 +1030,33 @@ Plymouth.SetUpdateStatusFunction (update_status_callback);
#
fun refresh_callback ()
{
- if (global.anim_status == "start") {
- anim_iter = 0;
- for (i = 0; i < ELECTRONS_DISPLAYED; i++) {
- ellipses[i].anim.angle = ellipses[i].anim.start_angle;
- }
- global.anim_status = "running";
- }
-
- if (global.anim_status == "running") {
- anim_done = 1;
- for (i = 0; i < ELECTRONS_DISPLAYED; i++) {
- if (anim_iter >= ellipses[i].anim.start_iter && anim_iter < ellipses[i].anim.stop_iter) {
- draw_electron(i);
-
- ellipses[i].anim.angle += ellipses[i].anim.angle_incr;
- # check if at least one of the animations needs more loops
- if (ellipses[i].anim.stop_iter > anim_iter) {
- anim_done = 0;
- }
- }
- }
- if (anim_done) {
- global.anim_status = "stopped";
- }
- anim_iter++;
- # DebugBottom ("anim iter = " + anim_iter);
- }
+ if (global.anim_status == "start") {
+ anim_iter = 0;
+ for (i = 0; i < ELECTRONS_DISPLAYED; i++) {
+ ellipses[i].anim.angle = ellipses[i].anim.start_angle;
+ }
+ global.anim_status = "running";
+ }
+
+ if (global.anim_status == "running") {
+ anim_done = 1;
+ for (i = 0; i < ELECTRONS_DISPLAYED; i++) {
+ if (anim_iter >= ellipses[i].anim.start_iter && anim_iter < ellipses[i].anim.stop_iter) {
+ draw_electron(i);
+
+ ellipses[i].anim.angle += ellipses[i].anim.angle_incr;
+ # check if at least one of the animations needs more loops
+ if (ellipses[i].anim.stop_iter > anim_iter) {
+ anim_done = 0;
+ }
+ }
+ }
+ if (anim_done) {
+ global.anim_status = "stopped";
+ }
+ anim_iter++;
+ # DebugBottom ("anim iter = " + anim_iter);
+ }
}
Plymouth.SetRefreshFunction (refresh_callback);
@@ -1069,22 +1069,22 @@ Plymouth.SetRefreshFunction (refresh_callback);
# is traveled in a sin([0,Pi/2])->[0,1] manner instead of linear increments
#
fun compute_angle_with_accel(ellipse) {
- # first map the [start_angle,start_angle+arc] to [0,Pi/2]
- angle_in_0_pi_2 = Math.Pi / 2 / ellipse.anim.arc * (ellipse.anim.angle - ellipse.anim.start_angle);
- # then compute sin and scale output to [start_angle,start_angle+arc]
- accel_angle = ellipse.anim.arc * Math.Sin(angle_in_0_pi_2) + ellipse.anim.start_angle;
- return accel_angle;
+ # first map the [start_angle,start_angle+arc] to [0,Pi/2]
+ angle_in_0_pi_2 = Math.Pi / 2 / ellipse.anim.arc * (ellipse.anim.angle - ellipse.anim.start_angle);
+ # then compute sin and scale output to [start_angle,start_angle+arc]
+ accel_angle = ellipse.anim.arc * Math.Sin(angle_in_0_pi_2) + ellipse.anim.start_angle;
+ return accel_angle;
}
# Computes the opacity factor so that the electrons visibility somehow matches that of the ellipses:
# Most visible in a middle part, and invisible at the oposite.
fun compute_opacity(ellipse) {
- # map the [start_angle,start_angle+arc] to [0,Pi]
- transformed_angle = Math.Pi / ellipse.anim.arc * (ellipse.anim.angle - ellipse.anim.start_angle);
- # and compute Math.Sin^2
- opacity_factor = Math.Sin(Math.Max(transformed_angle,-transformed_angle));
- opacity_factor *= opacity_factor;
- return opacity_factor;
+ # map the [start_angle,start_angle+arc] to [0,Pi]
+ transformed_angle = Math.Pi / ellipse.anim.arc * (ellipse.anim.angle - ellipse.anim.start_angle);
+ # and compute Math.Sin^2
+ opacity_factor = Math.Sin(Math.Max(transformed_angle,-transformed_angle));
+ opacity_factor *= opacity_factor;
+ return opacity_factor;
}
# Draw the 5 electron sprites to create a gradient effect
@@ -1092,16 +1092,16 @@ fun compute_opacity(ellipse) {
# The position is computed based on the .angle field, adapted with the acceleration function above.
#
fun draw_electron(index) {
- base_electron_x = ellipses[index].x - electron_image.GetWidth() / 2;
- base_electron_y = ellipses[index].y - electron_image.GetHeight() / 2;
- accel_angle = compute_angle_with_accel(ellipses[index]);
- opacity_factor = compute_opacity(ellipses[index]);
- for (j = 0; j < 5; j++) {
- electron_x = base_electron_x + ellipses[index].width * Math.Cos(accel_angle + electron_sprite[index][j].angle_diff);
- electron_y = base_electron_y + ellipses[index].height * Math.Sin(accel_angle + electron_sprite[index][j].angle_diff);
- electron_sprite[index][j].SetOpacity(opacity_factor * electron_sprite[index][j].base_opacity);
- electron_sprite[index][j].SetPosition(electron_x , electron_y, -10);
- }
+ base_electron_x = ellipses[index].x - electron_image.GetWidth() / 2;
+ base_electron_y = ellipses[index].y - electron_image.GetHeight() / 2;
+ accel_angle = compute_angle_with_accel(ellipses[index]);
+ opacity_factor = compute_opacity(ellipses[index]);
+ for (j = 0; j < 5; j++) {
+ electron_x = base_electron_x + ellipses[index].width * Math.Cos(accel_angle + electron_sprite[index][j].angle_diff);
+ electron_y = base_electron_y + ellipses[index].height * Math.Sin(accel_angle + electron_sprite[index][j].angle_diff);
+ electron_sprite[index][j].SetOpacity(opacity_factor * electron_sprite[index][j].base_opacity);
+ electron_sprite[index][j].SetPosition(electron_x , electron_y, -10);
+ }
}
@@ -1117,10 +1117,11 @@ fun display_normal_callback ()
if (message_notification[2].sprite) hide_message(2);
prompt_active = 0;
}
-
- if (message_notification[1].sprite) show_message (1);
-
-
+
+ if (message_notification[1].sprite) {
+ show_message (1);
+ }
+
}
Plymouth.SetDisplayNormalFunction (display_normal_callback);
@@ -1128,12 +1129,8 @@ Plymouth.SetDisplayNormalFunction (display_normal_callback);
#----------------------------------------- Quit --------------------------------
-# TODO: Maybe we should also hide any other dialog
-# Show the logo and make the progress indicator look full when on exit
fun quit_callback ()
{
- logo.sprite.SetOpacity (1);
- switch_on_bullets ();
}
Plymouth.SetQuitFunction(quit_callback);