respect signage

This commit is contained in:
jane 2021-05-26 12:39:01 -04:00
parent d4ddc674cc
commit 562d4572c7

View file

@ -97,21 +97,24 @@ function fade(index) {
var current_tick_g = Math.floor(Math.abs(diff_cg / diff_g) * fade_ticks); var current_tick_g = Math.floor(Math.abs(diff_cg / diff_g) * fade_ticks);
var current_tick_b = Math.floor(Math.abs(diff_cb / diff_b) * fade_ticks); var current_tick_b = Math.floor(Math.abs(diff_cb / diff_b) * fade_ticks);
if (diff_r == 0 || if (diff_r == 0 ||
Math.abs(current.r + interval_r) >= Math.abs(final.r) || (sign_r == 1 && current.r + interval_r >= final.r) ||
(sign_r == -1 && current.r + interval_r <= final.r) ||
current_tick_r + 1 >= fade_ticks) { current_tick_r + 1 >= fade_ticks) {
current.r = final.r; current.r = final.r;
interval_r = 0; interval_r = 0;
current_tick_r = fade_ticks; current_tick_r = fade_ticks;
} }
if (diff_g == 0 || if (diff_g == 0 ||
Math.abs(current.g + interval_g) >= Math.abs(final.g) || (sign_g == 1 && current.g + interval_g >= final.g) ||
(sign_g == -1 && current.g + interval_g <= final.g) ||
current_tick_g + 1 >= fade_ticks) { current_tick_g + 1 >= fade_ticks) {
current.g = final.g; current.g = final.g;
interval_g = 0; interval_g = 0;
current_tick_g = fade_ticks; current_tick_g = fade_ticks;
} }
if (diff_b == 0 || if (diff_b == 0 ||
Math.abs(current.b + interval_b) >= Math.abs(final.b) || (sign_b == 1 && current.b + interval_b >= final.b) ||
(sign_b == -1 && current.b + interval_b <= final.b) ||
current_tick_b + 1 >= fade_ticks) { current_tick_b + 1 >= fade_ticks) {
current.b = final.b; current.b = final.b;
interval_b = 0; interval_b = 0;