Пример #1
0
 public static AlignmentGeometry lerp(AlignmentGeometry a, AlignmentGeometry b, float t)
 {
     D.assert(t != null);
     if (a == null && b == null)
     {
         return(null);
     }
     if (a == null)
     {
         return(b * t);
     }
     if (b == null)
     {
         return(a * (1.0f - t));
     }
     if (a is Alignment && b is Alignment)
     {
         return(Alignment.lerp(a, b, t));
     }
     if (a is AlignmentDirectional && b is AlignmentDirectional)
     {
         return(AlignmentDirectional.lerp(a, b, t));
     }
     return(new _MixedAlignment(
                MathUtils.lerpNullableFloat(a._x, b._x, t),
                MathUtils.lerpNullableFloat(a._start, b._start, t),
                MathUtils.lerpNullableFloat(a._y, b._y, t)
                ));
 }
Пример #2
0
 public static AlignmentGeometry lerp(AlignmentGeometry a, AlignmentGeometry b, float t)
 {
     if (a == null && b == null)
     {
         return(null);
     }
     if (a == null)
     {
         return(b * t);
     }
     if (b == null)
     {
         return(a * (1.0f - t));
     }
     if (a is Alignment _a && b is Alignment _b)
     {
         return(Alignment.lerpAlignment(_a, _b, t));
     }
     if (a is AlignmentDirectional _ad && b is AlignmentDirectional _bd)
     {
         return(AlignmentDirectional.lerpAlignmentDirectional(_ad, _bd, t));
     }
     return(new _MixedAlignment(
                MathUtils.lerpNullableFloat(a._x, b._x, t),
                MathUtils.lerpNullableFloat(a._start, b._start, t),
                MathUtils.lerpNullableFloat(a._y, b._y, t)
                ));
 }
Пример #3
0
 public override string ToString()
 {
     if (_start == 0.0)
     {
         return(Alignment._stringify(_x, _y));
     }
     if (_x == 0.0)
     {
         return(AlignmentDirectional._stringify(_start, _y));
     }
     return(Alignment._stringify(_x, _y) + " + " + AlignmentDirectional._stringify(_start, 0.0));
 }