diff --git a/modules/Grid/Grid.cpp b/modules/Grid/Grid.cpp index 74956cb..1423396 100644 --- a/modules/Grid/Grid.cpp +++ b/modules/Grid/Grid.cpp @@ -56,6 +56,8 @@ class Grid : public ScreensaverPlugin { int _wait {7}; // seconds int _fade {3}; // seconds double _border {75}; + double _min_size {2}; + double _max_size {50}; void animate(); }; @@ -87,11 +89,11 @@ void Grid::setup(cairo_t* context, const cairo_rectangle_t& rect) { Rect r; r.cx = _border + h_margin + x * _d; r.cy = _border + v_margin + y * _d; - r.width = 50; + r.width = random_between(_min_size, _max_size); r.color = black; _old.rects.push_back(r); _cur.rects.push_back(r); - r.width = random_between(2, 50); + r.width = random_between(_min_size, _max_size); r.color = sc::random::choice(_colors); _new.rects.push_back(r); } @@ -99,6 +101,8 @@ void Grid::setup(cairo_t* context, const cairo_rectangle_t& rect) { } void Grid::configure() { + _min_size = _j["min-size"]; + _max_size = _j["max-size"]; _d = _j["dist"]; _wait = _j["wait"]; _fade = _j["fade"]; @@ -108,6 +112,7 @@ void Grid::configure() { for (const auto& hex : _j["colors"]) { _colors.emplace_back(hex); } + setup(_c, _r); } int Grid::fps() const { @@ -128,7 +133,7 @@ void Grid::update() { _frames = 0; _old = _new; for (Rect& r : _new.rects) { - r.width = random_between(2, 50); + r.width = random_between(_min_size, _max_size); r.color = sc::random::choice(_colors); } _s = State::wait;