From 91655454f639b58a6807035c77b1e9d54ede4205 Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Mon, 16 Nov 2020 11:21:34 +0100 Subject: [PATCH] made fade_time a const instead of magic number --- fading-rects/FadingRects.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fading-rects/FadingRects.cpp b/fading-rects/FadingRects.cpp index baf347e..c70255b 100644 --- a/fading-rects/FadingRects.cpp +++ b/fading-rects/FadingRects.cpp @@ -15,6 +15,7 @@ #include const int default_frames_per_rect {10}; +const int fade_time {5}; // seconds enum class FadingState { fadein, @@ -111,7 +112,7 @@ void FadingRects::update() { rect.cur_alpha = 0.0; rect.state = FadingState::fadein; rect.sustain_frame = 0; - rect.delta = rect.alpha / (5 * fps()); + rect.delta = rect.alpha / (fade_time * fps()); rect.line_width = random_between(1.0, 20.0); rect.x = rr.x; rect.y = rr.y;