From 302ff7743f7ac49c2c3e7c00dd227f32c2f63620 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Tue, 5 Dec 2017 12:38:55 +0100 Subject: [PATCH] Added PauseValue to FlashDecorator --- RGB.NET.Decorators/Brush/FlashDecorator.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/RGB.NET.Decorators/Brush/FlashDecorator.cs b/RGB.NET.Decorators/Brush/FlashDecorator.cs index 1d7daff..dd84f2c 100644 --- a/RGB.NET.Decorators/Brush/FlashDecorator.cs +++ b/RGB.NET.Decorators/Brush/FlashDecorator.cs @@ -51,6 +51,11 @@ namespace RGB.NET.Decorators.Brush /// public double SustainValue { get; set; } = 1; + /// + /// Gets or sets the level at which the oppacity (percentage) should stay in the pause-cycle. (default: 0); + /// + public double PauseValue { get; set; } = 0; + /// /// Gets or sets the interval (in seconds) in which the decorator should repeat (if repetition is enabled). (default: 1) /// @@ -84,7 +89,7 @@ namespace RGB.NET.Decorators.Brush if (_currentPhase == ADSRPhase.Attack) if (_currentPhaseValue > 0) - _currentValue = Math.Min(1, (Attack - _currentPhaseValue) / Attack) * AttackValue; + _currentValue = PauseValue + (Math.Min(1, (Attack - _currentPhaseValue) / Attack) * (AttackValue - PauseValue)); else { _currentPhaseValue = Decay; @@ -111,7 +116,7 @@ namespace RGB.NET.Decorators.Brush if (_currentPhase == ADSRPhase.Release) if (_currentPhaseValue > 0) - _currentValue = Math.Min(1, _currentPhaseValue / Release) * SustainValue; + _currentValue = PauseValue + (Math.Min(1, _currentPhaseValue / Release) * (SustainValue - PauseValue)); else { _currentPhaseValue = Interval; @@ -120,7 +125,7 @@ namespace RGB.NET.Decorators.Brush if (_currentPhase == ADSRPhase.Pause) if (_currentPhaseValue > 0) - _currentValue = 0; + _currentValue = PauseValue; else { if ((++_repetitionCount >= Repetitions) && (Repetitions > 0))