You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.3 KiB

5 years ago
using Colore;
using Colore.Data;
using Colore.Effects.Keyboard;
namespace ChromaController
{
internal partial class KeyEffect
{
public Key[] Keys { get; }
public Color Color1 { get; }
public Color Color2 { get; }
public int StepCounter { get; private set; }
public int DelayTime { get; }
public KeyEffect(Key[] keys, Color color1, Color color2, int delayTime)
{
Keys = keys;
Color1 = color1;
Color2 = color2;
StepCounter = 0;
DelayTime = delayTime;
}
virtual public bool Step(IChroma chroma)
{
StepCounter++;
return false;
}
protected static Color ColorMixer(Color color1, Color color2, float mix)
{
int red = (int)(color1.R * (1 - mix) + color2.R * mix);
int green = (int)(color1.G * (1 - mix) + color2.G * mix);
int blue = (int)(color1.B * (1 - mix) + color2.B * mix);
return GetColoreColor(red, green, blue);
}
internal static Color GetColoreColor(int red, int green, int blue)
{
return Color.FromRgb((uint)((red << 16) | (green << 8) | blue));
}
}
}