fix: color lerping not working properly
This commit is contained in:
@@ -95,7 +95,11 @@ public readonly struct ColorRGB(byte r, byte g, byte b) : IEquatable<ColorRGB>
|
||||
int greenDiff = to.G - from.G;
|
||||
int blueDiff = to.B - from.B;
|
||||
|
||||
return new((byte)(from.R - redDiff * t), (byte)(from.G - greenDiff * t), (byte)(from.B - blueDiff * t));
|
||||
return new(
|
||||
(byte)(from.R + redDiff * t),
|
||||
(byte)(from.G + greenDiff * t),
|
||||
(byte)(from.B + blueDiff * t)
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Engine.Core.Debug;
|
||||
|
||||
namespace Engine.Core;
|
||||
|
||||
@@ -125,7 +126,12 @@ public readonly struct ColorRGBA(byte r, byte g, byte b, byte a = 255) : IEquata
|
||||
int blueDiff = to.B - from.B;
|
||||
int alphaDiff = to.A - from.A;
|
||||
|
||||
return new((byte)(from.R - redDiff * t), (byte)(from.G - greenDiff * t), (byte)(from.B - blueDiff * t), (byte)(from.A - alphaDiff * t));
|
||||
return new(
|
||||
(byte)(from.R + redDiff * t),
|
||||
(byte)(from.G + greenDiff * t),
|
||||
(byte)(from.B + blueDiff * t),
|
||||
(byte)(from.A + alphaDiff * t)
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user