1
0
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:
SpoinkyNL 2016-04-27 22:18:12 +02:00
parent a3b983fb9c
commit e18b8adfb7
2 changed files with 15 additions and 3 deletions

View File

@ -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");

View File

@ -48,6 +48,18 @@ namespace Artemis.Models.Profiles
return;
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)));
}