mirror of
https://github.com/ZuneDev/MicrosoftIris.git
synced 2026-07-27 13:13:29 -07:00
Implement Interpolation encoding
This commit is contained in:
@@ -4,9 +4,11 @@
|
|||||||
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
|
||||||
// Assembly location: C:\Program Files\Zune\UIX.dll
|
// Assembly location: C:\Program Files\Zune\UIX.dll
|
||||||
|
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace Microsoft.Iris.Animations
|
namespace Microsoft.Iris.Animations
|
||||||
{
|
{
|
||||||
public class Interpolation
|
public class Interpolation : IStringEncodable
|
||||||
{
|
{
|
||||||
public static readonly Interpolation Default = new Interpolation(InterpolationType.Linear);
|
public static readonly Interpolation Default = new Interpolation(InterpolationType.Linear);
|
||||||
private InterpolationType _type;
|
private InterpolationType _type;
|
||||||
@@ -102,5 +104,19 @@ namespace Microsoft.Iris.Animations
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override int GetHashCode() => _type.GetHashCode() ^ _weight.GetHashCode() ^ _bezierHandle1.GetHashCode() ^ _bezierHandle2.GetHashCode() ^ _easePercent.GetHashCode();
|
public override int GetHashCode() => _type.GetHashCode() ^ _weight.GetHashCode() ^ _bezierHandle1.GetHashCode() ^ _bezierHandle2.GetHashCode() ^ _easePercent.GetHashCode();
|
||||||
|
|
||||||
|
public string EncodeString()
|
||||||
|
{
|
||||||
|
StringBuilder sb = new(Type.ToString());
|
||||||
|
|
||||||
|
if (Type is InterpolationType.Bezier)
|
||||||
|
sb.Append($", {BezierHandle1}, {BezierHandle2}");
|
||||||
|
else if (Type is InterpolationType.EaseOut or InterpolationType.EaseIn)
|
||||||
|
sb.Append($", {Weight}, {EasePercent}");
|
||||||
|
else if (Weight != 1.0)
|
||||||
|
sb.Append($", {Weight}");
|
||||||
|
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user