diff --git a/modules/Grid/Grid.cpp b/modules/Grid/Grid.cpp index 7a233d9..1d4a59f 100644 --- a/modules/Grid/Grid.cpp +++ b/modules/Grid/Grid.cpp @@ -50,7 +50,7 @@ class Grid : public ScreensaverPlugin { double _border {75}; double _min_size {2}; double _max_size {50}; - + bool _change_bg {true}; void animate(); }; @@ -100,6 +100,7 @@ void Grid::configure() { _fade = _j["fade"]; _border = _j["border"]; _new.bg = Color {_j["bg"]}; + _change_bg = _j["changebg"]; _colors.clear(); for (const auto& hex : _j["colors"]) { _colors.emplace_back(hex); @@ -156,10 +157,12 @@ void Grid::render() { void Grid::animate() { double f {static_cast(_frames) / (_fade * fps())}; - RGB bg1 {RGB(_old.bg)}; - RGB bg2 {RGB(_new.bg)}; - RGB bg3 {bg1.r + f * (bg2.r - bg1.r), bg1.g + f * (bg2.g - bg1.g), bg1.b + f * (bg2.b - bg1.b)}; - _cur.bg = bg3; + if (_change_bg) { + RGB bg1 {RGB(_old.bg)}; + RGB bg2 {RGB(_new.bg)}; + RGB bg3 {bg1.r + f * (bg2.r - bg1.r), bg1.g + f * (bg2.g - bg1.g), bg1.b + f * (bg2.b - bg1.b)}; + _cur.bg = bg3; + } for (size_t i = 0; i < _old.rects.size(); ++i) { Rect& r1 = _old.rects[i]; Rect& r2 = _new.rects[i]; diff --git a/modules/Grid/Grid.json b/modules/Grid/Grid.json index bddd090..05670cf 100644 --- a/modules/Grid/Grid.json +++ b/modules/Grid/Grid.json @@ -6,6 +6,7 @@ "fade": 7, "border": 100.0, "bg": "#B1D1AF", + "changebg": false, "colors": [ "#FFE3BF", "#170D00",