2019-02-01 17:19:20 +00:00
|
|
|
|
namespace RobloxFiles.DataTypes
|
2019-01-26 00:39:37 +00:00
|
|
|
|
{
|
2019-02-01 18:40:39 +00:00
|
|
|
|
public class UDim2
|
2019-01-26 00:39:37 +00:00
|
|
|
|
{
|
|
|
|
|
public readonly UDim X, Y;
|
|
|
|
|
|
|
|
|
|
public UDim Width => X;
|
|
|
|
|
public UDim Height => Y;
|
|
|
|
|
|
2019-02-01 18:40:39 +00:00
|
|
|
|
public UDim2(float scaleX = 0, int offsetX = 0, float scaleY = 0, int offsetY = 0)
|
2019-01-26 00:39:37 +00:00
|
|
|
|
{
|
|
|
|
|
X = new UDim(scaleX, offsetX);
|
|
|
|
|
Y = new UDim(scaleY, offsetY);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public UDim2(UDim x, UDim y)
|
|
|
|
|
{
|
|
|
|
|
X = x;
|
|
|
|
|
Y = y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
|
|
|
|
return '{' + X.ToString() + "},{" + Y.ToString() + '}';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public UDim2 Lerp(UDim2 other, float alpha)
|
|
|
|
|
{
|
|
|
|
|
float scaleX = X.Scale + ((other.X.Scale - X.Scale) * alpha);
|
|
|
|
|
int offsetX = X.Offset + (int)((other.X.Offset - X.Offset) * alpha);
|
|
|
|
|
|
|
|
|
|
float scaleY = Y.Scale + ((other.Y.Scale - Y.Scale) * alpha);
|
|
|
|
|
int offsetY = Y.Offset + (int)((other.Y.Offset - Y.Offset) * alpha);
|
|
|
|
|
|
|
|
|
|
return new UDim2(scaleX, offsetX, scaleY, offsetY);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|