Improve background hue animation algorithm