mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 21:24:16 +01:00
Add Reduced Motion for Notifications (#1732)
When Reduced Motion configuration is on, the expiry progressbar is removed, and instead a pie on top right is shown, and relative time update interval increases to 15 seconds. Progress wave animation also is suppressed.
This commit is contained in:
parent
fb60ac5b4b
commit
95defa200f
6 changed files with 185 additions and 49 deletions
|
|
@ -2,6 +2,7 @@ using System.Runtime.Loader;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Dalamud.Configuration.Internal;
|
||||
using Dalamud.Interface.Animation;
|
||||
using Dalamud.Interface.Animation.EasingFunctions;
|
||||
using Dalamud.Interface.Internal;
|
||||
|
|
@ -187,16 +188,18 @@ internal sealed partial class ActiveNotification : IActiveNotification
|
|||
set => this.newProgress = value;
|
||||
}
|
||||
|
||||
private static bool ReducedMotions => Service<DalamudConfiguration>.Get().ReduceMotions;
|
||||
|
||||
/// <summary>Gets the eased progress.</summary>
|
||||
private float ProgressEased
|
||||
{
|
||||
get
|
||||
{
|
||||
var underlyingProgress = this.underlyingNotification.Progress;
|
||||
if (Math.Abs(underlyingProgress - this.progressBefore) < 0.000001f || this.progressEasing.IsDone)
|
||||
if (Math.Abs(underlyingProgress - this.progressBefore) < 0.000001f || this.progressEasing.IsDone || ReducedMotions)
|
||||
return underlyingProgress;
|
||||
|
||||
var state = Math.Clamp((float)this.progressEasing.Value, 0f, 1f);
|
||||
var state = ReducedMotions ? 1f : Math.Clamp((float)this.progressEasing.Value, 0f, 1f);
|
||||
return this.progressBefore + (state * (underlyingProgress - this.progressBefore));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue