mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Implemented opacity dynamic property
This commit is contained in:
parent
a3b983fb9c
commit
e18b8adfb7
@ -122,7 +122,7 @@ namespace Artemis.Managers
|
||||
var tryCount = 0;
|
||||
while (PauseEffect != null)
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
Thread.Sleep(500);
|
||||
tryCount++;
|
||||
if (tryCount > 20)
|
||||
throw new Exception("Couldn't change effect before the time expired");
|
||||
|
||||
@ -47,8 +47,20 @@ namespace Artemis.Models.Profiles
|
||||
if (layerProp == null || userProp == null)
|
||||
return;
|
||||
|
||||
var percentage = ToDouble(gameProperty)/percentageSource;
|
||||
layerProp.SetValue(props, (int) (percentage*(int) userProp.GetValue(userProps, null)));
|
||||
var percentage = ToDouble(gameProperty) / percentageSource;
|
||||
|
||||
// Opacity requires some special treatment as it causes an exception if it's < 0.0 or > 1.0
|
||||
if (LayerProperty == "Opacity")
|
||||
{
|
||||
var opacity = percentage*(double) userProp.GetValue(userProps, null);
|
||||
if (opacity < 0.0)
|
||||
opacity = 0.0;
|
||||
if (opacity > 1.0)
|
||||
opacity = 1.0;
|
||||
layerProp.SetValue(props, opacity);
|
||||
}
|
||||
else
|
||||
layerProp.SetValue(props, (int) (percentage*(int) userProp.GetValue(userProps, null)));
|
||||
}
|
||||
|
||||
private void ApplyProp(LayerPropertiesModel props, LayerPropertiesModel userProps, IGameDataModel data)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user