t
This commit is contained in:
parent
d636fc88d2
commit
9491782686
1 changed files with 4 additions and 4 deletions
|
@ -62,21 +62,21 @@ function fade(index) {
|
|||
var current = int_to_rgb(pixels[index]);
|
||||
var final = int_to_rgb(next_pattern[index]);
|
||||
var diff_r = final.r - original.r;
|
||||
var diff_cr = current.r - original.r;
|
||||
var diff_g = final.g - original.g;
|
||||
var diff_b = final.b - original.b;
|
||||
var interval_r = diff_r / fade_ticks;
|
||||
var interval_g = diff_g / fade_ticks;
|
||||
var interval_b = diff_b / fade_ticks;
|
||||
|
||||
var current_tick = Math.floor((diff_cr / diff_r) * fade_ticks);
|
||||
|
||||
// console.log(`original: ${original.r} ${original.g} ${original.b}\n` +
|
||||
// `current: ${current.r} ${current.g} ${current.b}\n` +
|
||||
// `final: ${final.r} ${final.g} ${final.b}\n` +
|
||||
// `interval: ${interval_r} ${interval_g} ${interval_b}\n`)
|
||||
|
||||
if (final.r - current.r < interval_r &&
|
||||
final.g - current.g < interval_g &&
|
||||
final.b - current.b < interval_b
|
||||
) {
|
||||
if (current_tick + 1 >= fade_ticks) {
|
||||
console.log("FINISHED FADE FOR " + index);
|
||||
pixels[index] = next_pattern[index];
|
||||
pixel_cache[index] = next_pattern[index];
|
||||
|
|
Loading…
Reference in a new issue